:root {
  --bg: #07110f;
  --panel: #0f1e1b;
  --panel-2: #142823;
  --line: #254139;
  --text: #ecfff8;
  --muted: #9bb9af;
  --mint: #55f0b2;
  --gold: #f1c95b;
  --cyan: #5bd8f1;
  --danger: #ff7676;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(85, 240, 178, 0.24), transparent 38%),
    linear-gradient(180deg, #07110f 0%, #0a1513 48%, #050908 100%);
  color: var(--text);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.app-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 18px 16px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--mint);
  font-size: 12px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.balance {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid rgba(241, 201, 91, 0.45);
  border-radius: 8px;
  background: rgba(241, 201, 91, 0.12);
  text-align: right;
}

.balance span {
  display: block;
  color: var(--gold);
  font-size: 24px;
  font-weight: 800;
}

.balance small,
.progress-strip small,
.pot-meta,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.progress-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.progress-strip > div {
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 30, 27, 0.84);
}

.progress-strip span {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.garden-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.pot-card,
.panel,
.task-row,
.rank-row,
.redeem-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 30, 27, 0.88);
}

.pot-card {
  min-height: 372px;
  padding: 14px;
}

.plant-art {
  position: relative;
  height: 126px;
  margin: 4px auto 12px;
  overflow: visible;
}

.plant-art::before {
  position: absolute;
  right: 18%;
  bottom: 0;
  left: 18%;
  height: 16px;
  border: 1px solid rgba(85, 240, 178, 0.28);
  border-radius: 50%;
  background: rgba(91, 216, 241, 0.08);
  content: "";
}

.plant-art.art-active::after {
  position: absolute;
  top: 8px;
  right: 28%;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(246, 255, 248, 0.9);
  border-radius: 50%;
  box-shadow:
    28px 18px 0 -2px rgba(246, 255, 248, 0.8),
    -38px 34px 0 -1px rgba(85, 240, 178, 0.45),
    44px 70px 0 -3px rgba(241, 201, 91, 0.62);
  opacity: 0.68;
  animation: sparkle-drift 3.8s ease-in-out infinite;
  content: "";
}

.plant-sprite {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 118px;
  height: 118px;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 10px rgba(246, 255, 248, 0.32)) drop-shadow(0 0 12px rgba(85, 240, 178, 0.28));
  opacity: 0.96;
  transform-origin: 50% 82%;
  transition: width 240ms ease, height 240ms ease, bottom 240ms ease, opacity 240ms ease, filter 240ms ease;
  animation: plant-breathe 3.2s ease-in-out infinite;
}

.plant-lucky.stage-seedling {
  bottom: 18px;
  width: 76px;
  height: 76px;
  opacity: 0.82;
}

.plant-lucky.stage-sprout {
  bottom: 8px;
  width: 104px;
  height: 104px;
  opacity: 0.9;
}

.plant-lucky.stage-growing {
  bottom: -10px;
  width: 136px;
  height: 124px;
  animation: leaf-sway 3.4s ease-in-out infinite;
}

.plant-moon.stage-seedling {
  bottom: -10px;
  width: 120px;
  height: 116px;
  opacity: 0.9;
}

.plant-moon.stage-sprout {
  bottom: -14px;
  width: 134px;
  height: 124px;
}

.plant-moon.stage-growing {
  bottom: -18px;
  width: 148px;
  height: 132px;
  animation: moon-wiggle 3.6s ease-in-out infinite;
}

.plant-sprite.is-ready {
  filter: drop-shadow(0 0 14px rgba(246, 255, 248, 0.44)) drop-shadow(0 0 18px rgba(241, 201, 91, 0.28));
  animation: ready-bounce 2.4s ease-in-out infinite;
}

.plant-lucky.is-ready {
  bottom: -20px;
  width: 142px;
  height: 132px;
}

.plant-moon.is-ready {
  bottom: -24px;
  width: 158px;
  height: 142px;
}

.bud-fruit {
  position: absolute;
  bottom: -20px;
  left: 50%;
  width: 132px;
  height: 122px;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 13px rgba(246, 255, 248, 0.36)) drop-shadow(0 0 18px rgba(241, 201, 91, 0.24));
}

.pot-card.is-lit {
  box-shadow: inset 0 0 0 1px rgba(241, 201, 91, 0.22), 0 0 18px rgba(241, 201, 91, 0.08);
}

.pot-card.is-fertilized .plant-art::before {
  background: rgba(85, 240, 178, 0.16);
  border-color: rgba(85, 240, 178, 0.46);
}

.pot-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 6px;
}

.pot-title strong {
  font-size: 15px;
}

.pot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.pot-actions.full {
  grid-template-columns: 1fr;
}

.btn {
  min-height: 38px;
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
}

.btn.primary {
  color: #03130e;
  background: var(--mint);
  font-weight: 800;
}

.btn.gold {
  color: #1d1500;
  background: var(--gold);
  font-weight: 800;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.plant-picker {
  display: grid;
  gap: 8px;
}

.panel {
  padding: 14px;
}

.access-panel {
  padding: 18px;
  border: 1px solid rgba(241, 201, 91, 0.48);
  border-radius: 8px;
  background: rgba(48, 38, 16, 0.72);
}

.access-panel strong {
  color: var(--gold);
  font-size: 16px;
}

.access-code {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(241, 201, 91, 0.38);
  border-radius: 8px;
  background: rgba(5, 9, 8, 0.56);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  word-break: break-all;
}

.task-row,
.rank-row,
.redeem-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 10px;
  padding: 12px;
}

.status {
  color: var(--mint);
  font-weight: 800;
}

.status.warn {
  color: var(--gold);
}

.status.bad {
  color: var(--danger);
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(5, 9, 8, 0.92);
  backdrop-filter: blur(18px);
}

.tab {
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--panel-2);
  color: var(--mint);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 76px;
  left: 16px;
  z-index: 10;
  width: min(680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10231f;
  color: var(--text);
}

@keyframes plant-breathe {
  0%, 100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-3px) scale(1.018);
  }
}

@keyframes leaf-sway {
  0%, 100% {
    transform: translateX(-50%) rotate(-1.5deg) scale(1);
  }
  50% {
    transform: translateX(-50%) rotate(1.8deg) scale(1.015);
  }
}

@keyframes moon-wiggle {
  0%, 100% {
    transform: translateX(-50%) rotate(-1deg);
  }
  45% {
    transform: translateX(-50%) rotate(1.6deg) translateY(-2px);
  }
}

@keyframes ready-bounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-5px) scale(1.025);
  }
}

@keyframes sparkle-drift {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-5px) scale(1.12);
    opacity: 0.9;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  h1 {
    font-size: 24px;
  }

  .garden-grid {
    grid-template-columns: 1fr;
  }
}
