:root {
  color: #173021;
  background: #eef2ea;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.92), transparent 46%),
    #e9eee5;
}

button,
textarea,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(244, 113, 126, 0.88);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.phone {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 780 / 1388;
  overflow: hidden;
  border: 1px solid rgba(19, 54, 30, 0.12);
  border-radius: 32px;
  background: #264325;
  box-shadow:
    0 32px 90px rgba(40, 60, 37, 0.22),
    0 8px 24px rgba(40, 60, 37, 0.15);
  isolation: isolate;
}

.player-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.player-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 520ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.player-canvas.is-playing .player-preview {
  transform: scale(1.004);
}

/* 当前歌曲的 3D 倾斜专辑封面：覆盖在渲染图自带的封面槽位上。
   几何与 ai-3d-player/algo/player3d_compose.py 的 ALBUM_COVER 一致
   （780×1388 画布上的 x20 y35 w455 h485），zj/3d/*.png 已按同一透视预变形，
   四边形外透明，因此只替换倾斜封面、不遮挡其余画面。 */
.album-cover-overlay {
  position: absolute;
  left: 2.5641%;
  top: 2.5216%;
  width: 58.3333%;
  height: 34.9424%;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  object-fit: fill;
  transition: transform 520ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.player-canvas.is-playing .album-cover-overlay {
  transform: scale(1.004);
}

/* ---- hotspots ------------------------------------------------------- */

.player-hotspot {
  position: absolute;
  z-index: 3;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background: transparent;
  cursor: pointer;
}

.player-hotspot::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: inherit;
  border: 1px solid transparent;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.player-hotspot:hover::after,
.player-hotspot:focus-visible::after {
  border-color: rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.player-hotspot-favorite {
  left: 83.333%;
  top: 55.62%;
  width: 10.256%;
  height: 5.764%;
}

/* plant thumbnail — only the active plant, draggable over the player */
.player-hotspot-plant {
  left: 80.5%;
  top: 63.2%;
  width: 31%;
  height: 19%;
  border-radius: 14px;
  overflow: visible;
  background: transparent;
  display: grid;
  place-items: center;
  transition: transform 160ms ease;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.player-hotspot-plant::after {
  display: none;
}

.player-hotspot-plant:active {
  transform: none;
}

.player-hotspot-plant:focus-visible {
  outline: none;
}

.player-hotspot-plant:focus-visible .plant-thumb-emoji {
  transform: scale(1.05);
}

.player-hotspot-plant.is-dragging {
  cursor: grabbing;
  transition: none;
}

.plant-thumb-emoji {
  width: 100%;
  height: 100%;
  font-size: 52px;
  line-height: 1;
  color: #fff;
  pointer-events: none;
  transition: transform 300ms ease;
  position: relative;
  z-index: 1;
  text-shadow: none;
}

.player-canvas.is-playing .plant-thumb-emoji {
  animation: plant-thumb-breathe 2.2s ease-in-out infinite;
}

/* growth progress ring — appears on hover/play */
.player-hotspot-plant .plant-thumb-ring {
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  pointer-events: none;
  z-index: 0;
}

.player-hotspot-plant {
  --ring-color: rgba(122, 164, 108, 0.7);
}

.player-hotspot-plant[data-stage="mature"] {
  --ring-color: rgba(234, 113, 128, 0.8);
}

@keyframes plant-thumb-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.player-hotspot-comment {
  left: 64.103%;
  top: 74.784%;
  width: 10.256%;
  height: 5.764%;
}

.player-hotspot-more {
  left: 83.333%;
  top: 74.784%;
  width: 10.256%;
  height: 5.764%;
}

.player-hotspot-repeat {
  left: 6.41%;
  top: 88.761%;
  width: 10.256%;
  height: 5.764%;
}

.player-hotspot-previous {
  left: 26.923%;
  top: 88.761%;
  width: 10.256%;
  height: 5.764%;
}

.player-hotspot-play {
  left: 42.308%;
  top: 87.32%;
  width: 15.385%;
  height: 8.646%;
}

.player-hotspot-next {
  left: 62.821%;
  top: 88.761%;
  width: 10.256%;
  height: 5.764%;
}

.player-hotspot-playlist {
  left: 83.333%;
  top: 88.761%;
  width: 10.256%;
  height: 5.764%;
}

/* ---- toast ---------------------------------------------------------- */

.toast {
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: 28px;
  max-width: calc(100% - 44px);
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 31, 20, 0.82);
  box-shadow: 0 10px 34px rgba(14, 31, 18, 0.22);
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  backdrop-filter: blur(14px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- share link toast ------------------------------------------------- */

.share-link-toast {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(14, 25, 17, 0.45);
  backdrop-filter: blur(6px);
  animation: backdrop-in 200ms ease both;
}

.share-link-card {
  width: min(88%, 320px);
  padding: 20px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(14, 25, 17, 0.28);
  animation: sheet-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.share-link-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 750;
  color: #1a2d1f;
  text-align: center;
}

.share-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-link-row input {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #dfe4dc;
  border-radius: 12px;
  font-size: 12px;
  color: #3d4e43;
  background: #f8faf6;
}

.share-link-copy {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #ea7180;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.share-link-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.share-link-btn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #e0e5dc;
  border-radius: 12px;
  color: #314138;
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

/* ---- sheet layers --------------------------------------------------- */

.sheet-layer {
  position: absolute;
  z-index: 30;
  inset: 0;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(14, 25, 17, 0.38);
  backdrop-filter: blur(7px);
  cursor: pointer;
  animation: backdrop-in 220ms ease both;
}

.sheet {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  background: #f8f9f4;
  box-shadow: 0 -18px 55px rgba(17, 42, 25, 0.22);
  animation: sheet-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.farm-sheet {
  height: 100%;
  overflow-y: auto;
  padding: 10px 18px max(22px, env(safe-area-inset-bottom));
  scrollbar-width: none;
  border-radius: 0;
  background:
    linear-gradient(rgba(248, 249, 244, 0.9), rgba(248, 249, 244, 0.9)),
    var(--farm-background-image, none) center / cover no-repeat,
    #f8f9f4;
}

.farm-sheet::-webkit-scrollbar {
  display: none;
}

.generator-sheet {
  height: 91%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 10px 18px max(18px, env(safe-area-inset-bottom));
}

.sheet-grabber {
  width: 38px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: #d8ddd3;
}

.farm-header,
.generator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.farm-header h1,
.generator-header h2 {
  margin: 3px 0 0;
  color: #16271b;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.generator-header > div {
  flex: 1;
}

.section-label {
  margin: 0;
  color: #7a887c;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.round-button {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid #e0e5dc;
  border-radius: 50%;
  color: #26372b;
  background: #fff;
  cursor: pointer;
}

.round-button span {
  font-size: 24px;
  line-height: 1;
  transform: translateY(-1px);
}

/* ---- farm tabs ------------------------------------------------------ */

.farm-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 2px 12px;
  padding: 4px;
  border-radius: 14px;
  background: #eef2eb;
}

.farm-tab {
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 11px;
  color: #7a887c;
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.farm-tab.active {
  color: #1a2d1f;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.farm-tab-panel {
  animation: panel-in 200ms ease both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---- first plant banner (no plant yet) ------------------------------- */

.first-plant-banner {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px 16px;
  text-align: center;
}

.first-plant-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 24px;
  background: linear-gradient(145deg, #f5f9f0, #e8efe0);
  box-shadow: 0 8px 30px rgba(40, 60, 37, 0.08);
  padding: 16px;
}

.first-plant-text {
  margin: 0;
  font-size: 13px;
  color: #5a6b5e;
  line-height: 1.6;
  max-width: 260px;
}

/* ---- plant hero ------------------------------------------------------ */

.plant-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 4px 2px 12px;
}

.plant-hero-side {
  display: grid;
  gap: 4px;
  text-align: left;
  max-width: 160px;
}

.plant-hero-side strong {
  font-size: 14px;
  color: #1a2d1f;
}

.plant-hero-side > span {
  font-size: 12px;
  font-weight: 700;
  color: #ea7180;
}

.plant-hero-card {
  width: 175px;
  height: 175px;
  justify-self: center;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, #f5f9f0, #e8efe0);
  box-shadow: 0 8px 30px rgba(40, 60, 37, 0.08);
  overflow: hidden;
}

.plant-hero-card img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.grow-progress-mini,
.coplant-progress { display: grid; gap: 4px; max-width: 140px; }
.grow-progress-mini > div,
.coplant-progress > div { display: flex; justify-content: space-between; font-size: 10px; color: #8a958d; }
.grow-progress-mini > div strong,
.coplant-progress > div strong { font-size: 10px; color: #26372b; }
.grow-progress-mini > i,
.coplant-progress > i { height: 5px; overflow: hidden; border-radius: 99px; background: #e3e7df; }
.grow-progress-mini b,
.coplant-progress b { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #7aa46c, #ea7180); transition: width 600ms ease; }

.hero-water-btn {
  white-space: nowrap;
  width: 100%;
}

.hero-actions {
  display: grid;
  gap: 6px;
}

/* ---- plant carousel -------------------------------------------------- */

.plant-carousel {
  display: flex;
  gap: 10px;
  margin: 0 2px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.plant-carousel::-webkit-scrollbar { display: none; }

.carousel-item {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 2px solid #e2e6de;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  padding: 6px;
}

.carousel-item.active {
  border-color: #ea7180;
  box-shadow: 0 0 0 2px rgba(234,113,128,0.18);
}

.carousel-item.locked {
  border-style: dashed;
  border-color: #d0d8cc;
  background: #f5f7f3;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- plant gallery --------------------------------------------------- */

.plant-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 2px 14px;
}

.gallery-item {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 16px;
  background: #f8faf6;
  border: 1.5px solid #e8ece5;
}

.gallery-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  transition: filter 300ms ease, opacity 300ms ease;
}

.gallery-item.locked img {
  filter: grayscale(1);
  opacity: 0.35;
}

.gallery-item.current-stage {
  border-color: rgba(234,113,128,0.35);
  background: #fff3f4;
}

/* ---- plant visual image (replaces emoji) ----------------------------- */

.plant-visual-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  position: relative;
  z-index: 1;
}

/* ---- co-plant waiting ----------------------------------------------- */

.coplant-waiting { display: grid; justify-items: center; gap: 14px; padding: 30px 16px; text-align: center; }

.coplant-waiting-spin { font-size: 48px; animation: spin 2s linear infinite; }

.coplant-waiting-title { margin: 0; font-size: 16px; color: #1a2d1f; }
.coplant-waiting-title strong { color: #ea7180; }

.coplant-waiting-img { width: 80px; height: 80px; object-fit: contain; border-radius: 20px; background: linear-gradient(145deg, #f5f9f0, #e8efe0); padding: 12px; }

.coplant-waiting-sub { margin: 0; font-size: 12px; color: #7a887c; }

.coplant-waiting-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 260px; }

/* ---- coplant invites ------------------------------------------------- */

.coplant-invites { margin: 0 2px 16px; }

.coplant-invites-list { display: grid; gap: 8px; }

.coplant-invite-card {
  display: grid; gap: 10px;
  padding: 14px; border-radius: 16px;
  background: #fff; border: 1.5px solid #e8ece5;
}

.coplant-invite-card-header { display: flex; align-items: center; gap: 10px; }

.coplant-invite-card-header img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: #f0f4eb; padding: 6px; }

.coplant-invite-card-header strong { font-size: 13px; color: #1a2d1f; }

.coplant-invite-card-header span { font-size: 11px; color: #7a887c; }

.coplant-invite-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.coplant-invite-card-actions button {
  min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px;
  font-size: 11px; font-weight: 650; cursor: pointer;
}

.coplant-invite-accept { color: #fff; background: #7aa46c; }

.coplant-invite-decline { color: #7a887c; background: #f0f2ed; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- co-plant ------------------------------------------------------- */

.coplant-empty {
  display: grid; justify-items: center; gap: 12px;
  padding: 40px 16px; text-align: center;
}

.coplant-empty-icon { font-size: 56px; line-height: 1; }

.coplant-empty-title { margin: 0; font-size: 16px; font-weight: 750; color: #1a2d1f; }

.coplant-empty-sub { margin: 0; font-size: 12px; color: #7a887c; }

.coplant-header {
  text-align: center; font-size: 16px; color: #1a2d1f;
  margin: 8px 2px 16px;
}

.coplant-header strong { color: #ea7180; }

.coplant-plant {
  display: flex; align-items: center; gap: 16px;
  margin: 0 2px 14px;
  padding: 16px; border-radius: 20px;
  background: rgba(255,255,255,0.7); border: 1px solid #e8ece5;
}

.coplant-plant { flex-direction: row; text-align: left; align-items: center; }
.coplant-plant-img { width: 125px; height: 125px; object-fit: contain; border-radius: 20px; background: linear-gradient(145deg, #f5f9f0, #e8efe0); padding: 16px; flex-shrink: 0; margin: 0 auto; }

.coplant-plant-info { display: grid; gap: 4px; flex: 1; max-width: 160px; }

.coplant-plant-info strong { font-size: 14px; color: #1a2d1f; }

.coplant-plant-info > span { font-size: 12px; font-weight: 700; color: #ea7180; }


.coplant-days { text-align: center; font-size: 13px; color: #5a6b5e; margin: 0 0 14px; }

.coplant-days strong { font-size: 18px; color: #1a2d1f; }

/* messages */
.coplant-messages {
  display: grid; gap: 6px;
  max-height: 160px; overflow-y: auto;
  margin: 0 2px 8px;
  scrollbar-width: none;
}

.coplant-messages::-webkit-scrollbar { display: none; }

.coplant-msg {
  display: grid; gap: 2px;
  padding: 8px 12px; border-radius: 12px;
  background: #f8faf6; font-size: 11px;
}

.coplant-msg .msg-from { font-weight: 700; color: #5a6b5e; font-size: 10px; }

.coplant-msg .msg-text { color: #1a2d1f; }

.coplant-msg .msg-time { font-size: 9px; color: #b0b9b1; text-align: right; }

.coplant-msg-input {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  margin: 0 2px 14px;
}

.coplant-msg-input input {
  min-width: 0; padding: 10px 12px;
  border: 1px solid #dfe4dc; border-radius: 12px;
  font-size: 12px; color: #1a2d1f; background: #fff;
}

.coplant-msg-input button {
  padding: 0 14px; border: 0; border-radius: 12px;
  color: #fff; background: #ea7180;
  font-size: 12px; font-weight: 700; cursor: pointer;
}

/* tasks */
.coplant-tasks { display: grid; gap: 8px; margin: 0 2px 14px; }

.coplant-task {
  display: grid; gap: 4px;
  padding: 12px; border-radius: 14px;
  background: #f8faf6; border: 1px solid #eef1eb;
}

.coplant-task-header { display: flex; justify-content: space-between; font-size: 12px; }

.coplant-task-header span { color: #1a2d1f; }

.coplant-task-header strong { color: #7aa46c; font-size: 11px; }

.coplant-task-header strong.done { color: #7aa46c; }

.coplant-task > i { height: 5px; overflow: hidden; border-radius: 99px; background: #e3e7df; }

.coplant-task > i b { height: 100%; display: block; border-radius: inherit; background: #7aa46c; transition: width 600ms ease; }

.coplant-task.done { opacity: 0.7; }

.coplant-task.done > i b { background: #7aa46c; }

.coplant-task-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }

.coplant-task-row { display: flex; justify-content: flex-end; align-items: center; }

.coplant-task-right { display: flex; align-items: center; gap: 6px; }
.coplant-task-right strong { font-size: 10px; }

.coplant-task-btn {
  padding: 3px 10px; border: 1px solid #ea7180; border-radius: 10px;
  color: #ea7180; background: #fff; font-size: 10px; font-weight: 650; cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}

.coplant-task-btn:active { background: #ea7180; color: #fff; }

/* ---- ad modal -------------------------------------------------------- */

.ad-modal {
  position: absolute; z-index: 50; inset: 0;
  display: grid; place-items: center;
  background: rgba(14, 25, 17, 0.55);
  backdrop-filter: blur(6px);
  animation: backdrop-in 200ms ease both;
}

.ad-modal-card {
  width: min(80%, 280px);
  display: grid; justify-items: center; gap: 14px;
  padding: 24px 20px;
  border-radius: 22px; background: #fff;
  box-shadow: 0 16px 48px rgba(14, 25, 17, 0.28);
  text-align: center;
  animation: sheet-in 260ms ease both;
}

.ad-modal-title { margin: 0; font-size: 16px; font-weight: 750; color: #1a2d1f; }

.ad-modal-content {
  width: 100%; height: 120px;
  display: grid; place-items: center;
  border-radius: 14px; background: linear-gradient(145deg, #f0f5ea, #e8efe0);
  color: #a0aca3; font-size: 13px;
}

.ad-modal-timer { margin: 0; font-size: 14px; color: #5a6b5e; }

.ad-modal-timer strong { font-size: 22px; color: #ea7180; }

.ad-modal-close {
  padding: 6px 16px; border: 0; border-radius: 12px;
  color: #a0aca3; background: transparent; font-size: 11px; cursor: pointer;
}

/* ---- my plants grid -------------------------------------------------- */

.my-plants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.my-plants-empty {
  text-align: center;
  color: #b0b9b1;
  font-size: 12px;
  padding: 28px;
}

.my-plant-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  border: 1.5px solid #e2e6de;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.my-plant-card:hover {
  border-color: #c5cfc2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.my-plant-card.current {
  border-color: #ea7180;
  background: #fff3f4;
  box-shadow: 0 0 0 1px rgba(234,113,128,0.18);
}

.my-plant-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 14px;
  background: linear-gradient(145deg, #f5f9f0, #e8efe0);
  padding: 8px;
}

.my-plant-card strong {
  font-size: 11px;
  color: #1a2d1f;
}

.my-plant-card .current-badge {
  font-size: 9px;
  color: #ea7180;
  font-weight: 700;
}

/* ---- shop plants grid ------------------------------------------------ */

.shop-plants-grid {
  display: grid;
  gap: 10px;
}

.shop-plant-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1.5px solid #e2e6de;
  border-radius: 18px;
  background: #fff;
  transition: border-color 160ms ease;
}

.shop-plant-card.owned {
  border-color: rgba(122,164,108,0.4);
  background: #f8faf6;
}

.shop-plant-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 14px;
  background: linear-gradient(145deg, #f5f9f0, #e8efe0);
  padding: 8px;
}

.shop-plant-info strong {
  display: block;
  font-size: 13px;
  color: #1a2d1f;
}

.shop-plant-info small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #8a958d;
  line-height: 1.4;
}

.shop-plant-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #ea7180;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.shop-plant-btn:disabled {
  background: #c5d0c5;
  cursor: not-allowed;
}

.shop-plant-btn.owned-btn {
  background: #7aa46c;
}

/* ---- farm landscape ------------------------------------------------- */

.farm-landscape {
  position: relative;
  min-height: 112px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  overflow: hidden;
  padding: 16px;
  border-radius: 22px;
  color: #fff;
  background-image:
    linear-gradient(180deg, rgba(7, 24, 12, 0.04), rgba(7, 24, 12, 0.72)),
    url("/assets/default-player-preview.png");
  background-position: center 16%;
  background-size: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.farm-landscape-copy {
  display: grid;
  gap: 3px;
}

.farm-landscape-copy span {
  font-size: 11px;
  opacity: 0.78;
}

.farm-landscape-copy strong {
  font-size: 16px;
}

.harvest-chip {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: #183323;
  background: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 750;
  backdrop-filter: blur(10px);
  transition: background 300ms ease, border-color 300ms ease;
}

.harvest-chip.ready {
  border-color: rgba(234, 113, 128, 0.6);
  background: rgba(255, 240, 242, 0.92);
  color: #9d3340;
  animation: chip-pulse 1.8s ease-in-out infinite;
}

@keyframes chip-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ---- single plant display ------------------------------------------- */

.plant-display {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 14px 2px 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e8ece5;
}

.plant-visual-card {
  position: relative;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #f0f4eb;
  overflow: hidden;
  transition: background 400ms ease, box-shadow 400ms ease;
}

.plant-visual-card[data-stage="sprout"] {
  background: #e8f0df;
  box-shadow: 0 0 0 2px rgba(122, 164, 108, 0.25);
}

.plant-visual-card[data-stage="flower"] {
  background: #fef3e0;
  box-shadow: 0 0 0 2px rgba(244, 162, 97, 0.28);
}

.plant-visual-card[data-stage="mature"] {
  background: #ffeaea;
  box-shadow: 0 0 0 2px rgba(234, 113, 128, 0.35);
  animation: mature-card-glow 2s ease-in-out infinite;
}

@keyframes mature-card-glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(234, 113, 128, 0.25); }
  50% { box-shadow: 0 0 16px rgba(234, 113, 128, 0.4), 0 0 0 2px rgba(234, 113, 128, 0.5); }
}

.plant-visual-emoji {
  font-size: 36px;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: transform 300ms ease;
}

.plant-visual-card[data-stage="mature"] .plant-visual-emoji {
  animation: mature-bounce 1.6s ease-in-out infinite;
}

@keyframes mature-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  70% { transform: translateY(-3px); }
}

.plant-visual-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.plant-visual-rings i {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1.5px solid transparent;
}

.plant-visual-card[data-stage="mature"] .plant-visual-rings i:nth-child(1) {
  border-color: rgba(234, 113, 128, 0.3);
  animation: ring-expand 2s ease-out infinite;
}

.plant-visual-card[data-stage="mature"] .plant-visual-rings i:nth-child(2) {
  border-color: rgba(234, 113, 128, 0.18);
  animation: ring-expand 2s ease-out 0.6s infinite;
}

.plant-visual-card[data-stage="mature"] .plant-visual-rings i:nth-child(3) {
  border-color: rgba(234, 113, 128, 0.08);
  animation: ring-expand 2s ease-out 1.2s infinite;
}

@keyframes ring-expand {
  0% { inset: -2px; opacity: 1; }
  100% { inset: -18px; opacity: 0; }
}

.plant-info strong {
  display: block;
  font-size: 15px;
  color: #1a2d1f;
}

.plant-info small {
  display: block;
  margin-top: 3px;
  color: #7a887c;
  font-size: 11px;
}

/* ---- farm progress -------------------------------------------------- */

.farm-progress {
  display: grid;
  gap: 7px;
  margin: 0 2px 12px;
}

.farm-progress > div {
  display: flex;
  justify-content: space-between;
  color: #657269;
  font-size: 11px;
}

.farm-progress strong {
  color: #26372b;
}

.farm-progress > i {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #e3e7df;
}

.farm-progress b {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #7aa46c, #ea7180);
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---- farm actions --------------------------------------------------- */

.farm-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 2px 16px;
}

.farm-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 42px;
  padding: 0 8px;
  border: 1px solid #e0e5dc;
  border-radius: 14px;
  color: #314138;
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.farm-action-btn:active {
  background: #f2f5ef;
}

.farm-action-btn:disabled {
  color: #b0b9b1;
  cursor: not-allowed;
  background: #f3f5f1;
}

.farm-action-btn:not(:disabled):hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.farm-action-btn span {
  font-size: 16px;
  line-height: 1;
}

/* ---- subsection titles ---------------------------------------------- */

.subsection-title {
  margin: 0 0 8px;
  color: #4a5850;
  font-size: 14px;
  font-weight: 700;
}

/* ---- plant selector ------------------------------------------------- */

.plant-selector-section {
  margin: 0 2px 14px;
}

.plant-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.plant-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 6px 9px;
  border: 1.5px solid #e2e6de;
  border-radius: 15px;
  color: #27382c;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.plant-card:hover {
  border-color: #c5cfc2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.plant-card[aria-selected="true"] {
  border-color: #ea7180;
  background: #fff3f4;
  box-shadow: 0 0 0 1px rgba(234, 113, 128, 0.18);
}

.plant-card.locked {
  color: #b0b9b1;
  background: #f3f5f1;
  cursor: not-allowed;
  border-style: dashed;
}

.plant-card.locked:hover {
  border-color: #dce2d8;
  box-shadow: none;
}

.plant-card-emoji {
  font-size: 28px;
  line-height: 1.1;
}

.plant-card strong {
  font-size: 11px;
  line-height: 1.2;
}

.plant-card small {
  font-size: 9px;
  color: #8a958d;
  line-height: 1.2;
}

.plant-card.locked small {
  color: #b0b9b1;
}

/* ---- memorial log --------------------------------------------------- */

.memorial-section {
  margin: 0 2px 14px;
}

.memorial-log {
  display: grid;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: none;
}

.memorial-log::-webkit-scrollbar {
  display: none;
}

.memorial-empty {
  margin: 0;
  padding: 16px;
  text-align: center;
  color: #b0b9b1;
  font-size: 11px;
  border: 1px dashed #e2e6de;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
}

.memorial-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #eef1eb;
  font-size: 11px;
  color: #3d4e43;
}

.memorial-entry-type {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 13px;
  flex-shrink: 0;
}

.memorial-entry-type.water { background: #e0f0ff; }
.memorial-entry-type.growth { background: #e8f5e0; }
.memorial-entry-type.harvest { background: #fff0e0; }

.memorial-entry-time {
  color: #a0aca3;
  font-size: 9px;
  white-space: nowrap;
}

/* ---- memorial card preview ------------------------------------------ */

.memorial-card-section {
  margin: 0 2px 14px;
  animation: card-section-in 350ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes card-section-in {
  from { opacity: 0; transform: translateY(16px); }
}

.memorial-card-preview {
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(40, 50, 30, 0.12);
  background: #fef9f0;
}

.memorial-card-preview canvas {
  width: 100%;
  height: auto;
  display: block;
}

.memorial-message-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.memorial-message-field span {
  font-size: 11px;
  font-weight: 650;
  color: #5a6b5e;
}

.memorial-message-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #dfe4dc;
  border-radius: 14px;
  color: #24342a;
  background: #fff;
  font-size: 13px;
  line-height: 1.4;
}

.memorial-message-field input::placeholder {
  color: #bcc5bd;
}

.memorial-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

/* ---- generate entry ------------------------------------------------- */

.generate-entry {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding: 13px;
  border: 0;
  border-radius: 18px;
  color: #213027;
  background: #edf1e9;
  text-align: left;
  cursor: pointer;
}

.player-customization-section {
  margin-top: 28px;
  padding: 22px 0 max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(35, 61, 42, 0.1);
}

.player-customization-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.player-customization-heading h2,
.player-customization-heading small {
  margin: 0;
}

.player-customization-heading h2 {
  color: #24372a;
  font-size: 15px;
}

.player-customization-heading small {
  color: #8a968c;
  font-size: 10px;
}

.player-customization-section .generate-entry {
  margin: 16px 0 0;
}

.generate-entry-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: #ea7180;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.generate-entry strong,
.generate-entry small {
  display: block;
}

.generate-entry strong {
  font-size: 13px;
}

.generate-entry small {
  margin-top: 4px;
  color: #77837a;
  font-size: 10px;
}

.chevron {
  color: #93a096;
  font-size: 26px;
}

.player-style-library {
  margin: 0 0 14px;
}

.player-style-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 9px;
}

.player-style-heading h2,
.player-style-heading h3 {
  margin: 0;
  color: #1b2c20;
  font-size: 14px;
}

.player-style-heading small {
  color: #89938b;
  font-size: 10px;
}

.player-style-list {
  display: flex;
  gap: 10px;
  margin: 0 -18px;
  padding: 2px 18px 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.player-style-list::-webkit-scrollbar {
  display: none;
}

.player-style-card {
  width: 88px;
  flex: 0 0 88px;
  display: grid;
  gap: 6px;
  padding: 5px;
  border: 1px solid #dfe5dc;
  border-radius: 16px;
  color: #27372d;
  background: #fff;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.player-style-card img {
  width: 100%;
  aspect-ratio: 780 / 1388;
  display: block;
  object-fit: cover;
  border-radius: 11px;
  background: #dfe7dd;
}

.player-style-card span {
  overflow: hidden;
  padding: 0 2px 2px;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-style-card.is-active {
  border-color: #ea7180;
  box-shadow: 0 0 0 2px rgba(234, 113, 128, 0.18);
}

.player-style-preview {
  height: min(88%, 720px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 10px 18px max(18px, env(safe-area-inset-bottom));
}

.player-style-preview-body {
  min-height: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  overflow: hidden;
}

.player-style-preview-body img {
  width: auto;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: contain;
  border-radius: 18px;
  background: #dfe7dd;
}

.player-style-preview-body strong {
  color: #26372b;
  font-size: 13px;
}

.player-style-preview-actions {
  padding-top: 14px;
}

.player-style-preview-actions .primary-action {
  width: 100%;
}

/* ---- generator (unchanged) ------------------------------------------ */

.generator-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 1px 2px 18px;
  scrollbar-width: none;
}

.generator-scroll::-webkit-scrollbar {
  display: none;
}

.upload-card {
  position: relative;
  height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed #c8d0c5;
  border-radius: 22px;
  background: #eff2ec;
  cursor: pointer;
}

.upload-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: #2d3d32;
}

.upload-empty small {
  color: #8a958d;
  font-size: 10px;
}

.upload-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #dde2da;
  border-radius: 15px;
  color: #ea7180;
  background: #fff;
  font-size: 25px;
}

.upload-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.change-photo {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(19, 34, 23, 0.72);
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.prompt-field {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 17px;
}

.prompt-field > span,
.style-field legend {
  color: #2b3a30;
  font-size: 12px;
  font-weight: 750;
}

.prompt-field textarea {
  width: 100%;
  resize: none;
  padding: 13px 14px 28px;
  border: 1px solid #dfe4dc;
  border-radius: 17px;
  color: #24342a;
  background: #fff;
  font-size: 12px;
  line-height: 1.55;
}

.prompt-field textarea::placeholder {
  color: #a2aba4;
}

.prompt-field small {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: #9aa39c;
  font-size: 9px;
}

.style-field {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.style-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.style-option {
  display: grid;
  gap: 3px;
  padding: 11px 9px;
  border: 1px solid #dfe4dc;
  border-radius: 14px;
  color: #334239;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.style-option span {
  font-size: 11px;
  font-weight: 750;
}

.style-option small {
  color: #8c978e;
  font-size: 9px;
}

.style-option.selected {
  border-color: #ea7180;
  background: #fff3f4;
  box-shadow: 0 0 0 1px rgba(234, 113, 128, 0.18);
}

.generation-state {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 13px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 17px;
  background: #eef2eb;
}

.generation-state strong {
  display: block;
  font-size: 12px;
}

.generation-state p {
  margin: 4px 0 0;
  color: #7b887e;
  font-size: 10px;
  line-height: 1.45;
}

.generation-orbit {
  position: relative;
  width: 38px;
  height: 38px;
  border: 1px solid #cad4c8;
  border-radius: 50%;
  animation: orbit 1.5s linear infinite;
}

.generation-orbit i,
.generation-orbit b {
  position: absolute;
  border-radius: 50%;
}

.generation-orbit i {
  width: 8px;
  height: 8px;
  top: -3px;
  left: 15px;
  background: #ea7180;
}

.generation-orbit b {
  width: 15px;
  height: 15px;
  inset: 11px;
  background: #7aa46c;
}

.result-card {
  width: min(100%, 248px);
  margin: 18px auto 4px;
  padding: 8px;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(29, 52, 34, 0.18);
}

.result-card img {
  width: 100%;
  aspect-ratio: 780 / 1388;
  display: block;
  border-radius: 16px;
  object-fit: contain;
  object-position: top;
  background: #17301f;
}

.result-card > div {
  padding: 11px 6px 5px;
  color: #23352a;
  background: transparent;
}

.result-card span,
.result-card strong {
  display: block;
}

.result-card span {
  font-size: 9px;
  color: #9b5c66;
}

.result-card strong {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.4;
}

.result-card[data-reference-driven="true"] span {
  color: #54804d;
}

.form-error {
  margin: 14px 0 0;
  padding: 11px 12px;
  border-radius: 13px;
  color: #9d3340;
  background: #fff0f2;
  font-size: 11px;
  line-height: 1.45;
}

.generator-footer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid #e7ebe4;
  background: #f8f9f4;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.primary-action {
  grid-column: 1 / -1;
  border: 0;
  color: #fff;
  background: #ea7180;
  box-shadow: 0 9px 24px rgba(234, 113, 128, 0.24);
}

.primary-action:disabled {
  color: #a4ada5;
  background: #e3e7e0;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-action {
  border: 1px solid #dce2d9;
  color: #314138;
  background: #fff;
}

.secondary-action:not([hidden]) + .primary-action {
  grid-column: auto;
}

/* ---- keyframes ------------------------------------------------------ */

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

/* ---- responsive ----------------------------------------------------- */

@media (max-width: 520px) {
  .app-stage {
    padding: 0;
    background: #1c3822;
  }

  .phone {
    width: min(100vw, calc(100dvh * 780 / 1388));
    height: auto;
    aspect-ratio: 780 / 1388;
    border: 0;
    border-radius: min(22px, 5vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
