/* station.css — GreenSprouts Station shell.
   Loaded AFTER hub.css, so it restyles the shell (login, header, home, tree, tiles) while
   hub.css keeps supplying the component parts (feed rows, chips, cards, forms).

   Direction: owls are nocturnal, so the hero is dusk — a deep green sky and a lit tree —
   and everything below it is calm daylight cream. The gold in the tree is the money. */

:root {
  --sky-300: #8fd4f7;
  --sky-100: #d6f0fb;
  --lawn: #4fae5a;
  --soil: #7d5130;
  --sun: #ffd24c;
  --tile-ring: #d9f0e0;
}

body {
  background: var(--cream);
  font-family: "Nunito", system-ui, sans-serif;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
#appbar {
  background: linear-gradient(180deg, #1ea14e, #14773c);
  border-bottom: none;
  box-shadow: 0 2px 14px rgba(20, 119, 60, 0.26);
}
#appbar .brand-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #ffffff;
  font-size: 19px;
}
#appbar .who { color: #cdeed8; }
#appbar .btn-sm.signout {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.28);
}
#appbar .btn-sm.signout:hover { background: rgba(255, 255, 255, 0.28); }

/* ── The tree ───────────────────────────────────────────────────────────────── */
.tree-hero {
  margin: 0 0 22px;
  position: relative;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(8, 35, 26, 0.28);
}
/* The scene is drawn at 800×460 and scaled to COVER, so it never letterboxes. Heights below
   keep the container's aspect near the artwork's — otherwise cover would zoom in and crop the
   moon and canopy. On wide screens the stage is capped and centred for the same reason. */
.tree-stage {
  position: relative;
  height: clamp(200px, 26vh, 300px);
  background: var(--sky-100); /* fills before the SVG paints; no flash of white */
}
/* A painted hero (assets/hero.jpg) takes over the scene when present; the live overlays —
   name plates, coins, balance — stay on top. See README, "Using a painted hero". */
.tree-stage.has-painted { background: var(--hero-img) center/cover no-repeat, var(--sky-100); }
.tree-stage.has-painted .tree-svg { opacity: 0; pointer-events: none; }
@media (min-width: 780px) {
  .tree-hero { background: var(--sky-100); }
  .tree-stage { max-width: 760px; margin: 0 auto; }
}
.tree-svg { display: block; width: 100%; height: 100%; }

.owl-plates { position: absolute; inset: 0; pointer-events: none; }
.owl-plate {
  position: absolute;
  transform: translate(-50%, 14px);
  pointer-events: auto;
  font: 800 11.5px/1 "Nunito", system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #235c39;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #ffffff;
  border-radius: 99px;
  padding: 4px 10px;
  white-space: nowrap;
  cursor: default;
  box-shadow: 0 2px 8px rgba(35, 92, 57, 0.25);
}
button.owl-plate { cursor: pointer; }
button.owl-plate:hover { background: #fff; border-color: var(--green-500); }
.owl-plate.is-me {
  color: #6b4400;
  background: var(--sun);
  border-color: #fff;
  box-shadow: 0 3px 10px rgba(239, 147, 0, 0.4);
}

/* The balance card straddles the bottom edge of the scene instead of floating over it —
   overlaid, it covered the owls' name plates. */
.tree-caption {
  position: relative;
  z-index: 2;
  margin: -30px 16px 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.tree-fruit-count { display: flex; flex-direction: column; gap: 2px; }
.tree-fruit-count {
  background: #ffffff;
  border: 2px solid var(--tile-ring);
  border-radius: 20px;
  padding: 10px 18px 12px;
  box-shadow: 0 6px 18px rgba(35, 92, 57, 0.18);
}
.tfc-num {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 600;
  line-height: 0.95;
  color: var(--green-900);
  letter-spacing: -0.02em;
}
.tfc-lbl {
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: #b07600;
}
.tree-sub {
  margin: 0; max-width: 28ch; text-align: right;
  font-size: 13px; font-weight: 800; color: #235c39;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 14px; padding: 7px 12px;
}

/* ── Login ──────────────────────────────────────────────────────────────────── */
.station-login {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--cream);
}
.station-login .tree-hero { border-radius: 0; margin: 0; box-shadow: none; flex: 0 0 auto; }
/* Height tracks the artwork's 800×460 aspect so `cover` crops as little as possible. */
.station-login .tree-stage { height: clamp(200px, 27vh, 330px); max-width: none; }
.login-panel {
  background: var(--cream);
  padding: 24px 22px 36px;
  text-align: center;
  flex: 1 1 auto;
}
.login-wordmark {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--green-900);
  margin: 0 0 6px;
}
.login-wordmark .lw-green { color: var(--green-700); }
.login-tag {
  margin: 0 auto 22px; max-width: 34ch;
  color: var(--muted); font-size: 14.5px; font-weight: 700;
}
.btn.google-big {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; max-width: 340px; margin: 0 auto;
  background: #fff; color: #2b3a31;
  padding: 15px 22px; font-size: 16.5px; font-weight: 800;
  border-radius: 99px; border: 2px solid var(--tile-ring);
  box-shadow: 0 5px 0 #cfe8d6, 0 10px 22px rgba(35, 92, 57, 0.14);
}
.btn.google-big:hover { transform: translateY(-1px); box-shadow: 0 6px 0 #cfe8d6, 0 12px 24px rgba(35, 92, 57, 0.18); }
.btn.google-big:active { transform: translateY(3px); box-shadow: 0 2px 0 #cfe8d6; }
.g-mark { width: 21px; height: 21px; flex: none; }
.login-foot { margin: 18px auto 0; max-width: 36ch; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.login-msg { min-height: 20px; margin: 12px 0 0; font-size: 13.5px; font-weight: 800; color: var(--red-d); }

/* ── Balance banner (replaces the retired generated tree hero) ──────────────── */
.balance-hero {
  background: linear-gradient(160deg, #1ea14e, #14773c);
  padding: 22px 16px 26px;
  border-radius: 0 0 28px 28px;
  box-shadow: 0 10px 26px rgba(20, 119, 60, 0.24);
  margin-bottom: 20px;
}
.bh-inner { max-width: 860px; margin: 0 auto; }
.bh-lbl {
  font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #b9ebc9;
}
.bh-num {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(40px, 12vw, 60px); font-weight: 600; line-height: 1;
  color: #fff; letter-spacing: -0.02em; margin: 4px 0 6px;
}
.bh-sub { font-size: 13px; font-weight: 700; color: #cdeed8; max-width: 34ch; }

/* ── The family's own artwork ───────────────────────────────────────────────── */
#appbar .brand-logo { display: flex; align-items: center; }
.brand-img { display: block; border-radius: 9px; background: #fff; }

/* Sign-in: the printed roundel up top, the hand-drawn original at the foot. */
.login-hero { padding: 26px 20px 6px; text-align: center; background: var(--cream); }
.login-logo-img { width: min(78vw, 330px); height: auto; display: inline-block; }
.login-origin { margin: 30px auto 0; max-width: 340px; }
.login-origin-img {
  width: 100%; height: auto; display: block;
  border-radius: 16px; border: 3px solid #fff;
  box-shadow: 0 8px 22px rgba(35, 92, 57, 0.18);
}
.login-origin-cap {
  margin: 12px 0 0; text-align: center;
  font-size: 12.5px; font-weight: 800; letter-spacing: .04em; color: var(--muted);
}

/* Growth ladder */
.tier-card {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(150deg, #fff 55%, #fffaf0);
  border: 2px solid #ffe6b4; border-radius: 22px;
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.tier-art { width: 84px; height: 84px; object-fit: contain; flex: none; }
.tier-body { min-width: 0; flex: 1 1 auto; }
.tier-step {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: #b07600;
}
.tier-name {
  font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 600;
  color: var(--green-900); line-height: 1.15; margin: 1px 0 8px;
}
.tier-bar {
  height: 9px; border-radius: 99px; background: #eef4ef; overflow: hidden;
}
.tier-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #46cf73, #ffb020);
}
.tier-next { margin-top: 7px; font-size: 12.5px; font-weight: 700; color: var(--muted); }

@media (max-width: 380px) {
  .tier-art { width: 64px; height: 64px; }
  .tier-name { font-size: 17.5px; }
}

/* ── Home: app tiles ───────────────────────────────────────────────────────── */
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px 40px; }
.section-eyebrow {
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 26px 0 10px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 6px;
  background: #fff; border: 2px solid var(--tile-ring); border-radius: 20px;
  padding: 16px 15px 15px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.tile:hover { transform: translateY(-3px); border-color: var(--green-500); box-shadow: var(--shadow); }
.tile:focus-visible { outline: 3px solid var(--green-700); outline-offset: 2px; }
.tile-ic { font-size: 27px; line-height: 1; }
.tile-ic.art { font-size: 0; line-height: 0; }
.tile-art {
  width: 56px; height: 56px; display: block; border-radius: 14px;
  box-shadow: 0 2px 8px rgba(35, 92, 57, 0.16);
}
.tile-name { font-family: "Fraunces", Georgia, serif; font-size: 17.5px; font-weight: 600; }
.tile-sub { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.tile.soon { opacity: .58; pointer-events: none; }
.tile.soon .tile-sub { color: var(--gold-d); }
.tile.rewards { background: linear-gradient(160deg, #fff 60%, #fff6e0); border-color: #ffe0a3; }

/* ── Home: quick stats ─────────────────────────────────────────────────────── */
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.stat {
  background: #fff; border: 2px solid var(--tile-ring); border-radius: 18px; padding: 13px 15px;
}
.stat-num { font-family: "Fraunces", Georgia, serif; font-size: 24px; font-weight: 600; color: var(--green-900); }
.stat-lbl { font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.backlink {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 18px 0 4px; background: none; border: none; cursor: pointer;
  font: 800 13.5px "Nunito", system-ui, sans-serif; color: var(--green-900);
}
.backlink:hover { text-decoration: underline; }

/* ── Reward shop ────────────────────────────────────────────────────────────
   Kid side: a grid of prize cards (big emoji, price pill, one clear Buy button) and the
   "My prizes" list where a fulfilled purchase shows its claim code as a tear-off ticket.
   Grown-up side: the catalog editor rows. Sized to work at 375px first. */

.tile.shop { background: linear-gradient(160deg, #fff 60%, #f3ecff); border-color: #ded0ff; }

.shop-card .prize-grid { margin-top: 12px; }
/* auto-fill + minmax(0,1fr) keeps two columns on a 375px phone without overflowing. */
.prize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 12px;
}
.prize-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  background: linear-gradient(170deg, #ffffff 62%, #fffaf0);
  border: 2px solid var(--tile-ring); border-radius: 20px;
  padding: 15px 11px 13px;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.prize-card:hover { transform: translateY(-3px); border-color: var(--green-500); box-shadow: var(--shadow); }
.prize-emoji { font-size: 40px; line-height: 1.1; }
.prize-name {
  font-family: "Fraunces", Georgia, serif; font-size: 15.5px; font-weight: 600;
  color: var(--green-900); overflow-wrap: anywhere;
}
.prize-price {
  background: var(--sun); color: #6b4400;
  border-radius: 99px; padding: 3px 13px;
  font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prize-card .buy-btn { width: 100%; margin-top: 3px; padding: 10px 12px; font-size: 15px; }
.prize-why { font-size: 11.5px; font-weight: 800; color: var(--gold-d); overflow-wrap: anywhere; }

/* Can't afford it: dimmed, but the card and the reason stay readable. */
.prize-card.is-locked { background: #fbfdfb; border-color: #e6efe9; box-shadow: none; }
.prize-card.is-locked:hover { transform: none; border-color: #e6efe9; box-shadow: none; }
.prize-card.is-locked .prize-emoji { filter: grayscale(0.85); opacity: .75; }
.prize-card.is-locked .prize-price { background: #eef3ef; color: var(--muted); }

/* ── My prizes ─────────────────────────────────────────────────────────────── */
.prize-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.prize-row { display: flex; flex-direction: column; gap: 7px; }
.pl-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pl-emoji { font-size: 24px; line-height: 1; flex: none; }
/* min-width keeps a short name whole and pushes the chip to the next line instead;
   overflow-wrap still rescues genuinely long names. */
.pl-name { font-weight: 800; color: var(--green-900); flex: 1 1 auto; min-width: 96px; overflow-wrap: anywhere; }
.pl-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-reason { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* The claim code: a tear-off ticket, because that's what the kid shows to claim the prize. */
.coupon {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: repeating-linear-gradient(135deg, #fff8e1, #fff8e1 9px, #fffdf6 9px, #fffdf6 18px);
  border: 2px dashed var(--gold-d); border-radius: 14px;
  padding: 10px 12px;
}
.coupon-lbl {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: #8a5a00;
}
.coupon-code {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: clamp(19px, 5.6vw, 25px); font-weight: 700; letter-spacing: 0.09em;
  color: var(--green-900);
  overflow-wrap: anywhere; text-align: center;
}

/* ── Grown-up: approvals + catalog editor ──────────────────────────────────── */
.ap-prize { font-weight: 700; overflow-wrap: anywhere; }

/* flex-start so the three labels sit on one line even though the emoji box is taller. */
.shop-add { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-top: 4px; }
.sa-field { display: flex; flex-direction: column; }
.sa-field .field-label { margin-top: 0; }
.sa-field input { margin: 3px 0 0; }
.sa-emoji { flex: 0 0 74px; }
.sa-emoji input { text-align: center; font-size: 20px; }
.sa-name { flex: 1 1 150px; min-width: 0; }
.sa-price { flex: 0 0 108px; }
.sa-price input { text-align: right; }

.shop-row { display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px; }
.shop-row.is-off { opacity: .72; }
.sr-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.sr-emoji { font-size: 24px; line-height: 1; flex: none; }
.sr-name {
  font-family: "Fraunces", Georgia, serif; font-size: 16px; font-weight: 600;
  color: var(--green-900); flex: 1; min-width: 0; overflow-wrap: anywhere;
}
.sr-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sr-controls .prefix { font-weight: 800; color: var(--muted); }
.sr-controls input.sr-price { width: 88px; margin: 0; text-align: right; }
.sr-controls .btn-sm.sr-off { background: var(--sun); color: #6b4400; }
.sr-controls .btn-sm.sr-off:hover { background: #ffdd80; }
/* A small destructive button — .btn-danger is full-size by default. */
.btn-danger.btn-sm-danger { padding: 7px 13px; font-size: 13px; box-shadow: 0 2px 0 #b23e1f; }

/* A ready-to-claim purchase gets its own chip colour (see purchaseChip in hub-core). */
.chip-ready { background: #fff0cc; color: #8a5a00; }

@media (max-width: 400px) {
  .prize-grid { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 10px; }
  .prize-emoji { font-size: 34px; }
  .prize-card { padding: 13px 9px 11px; }
  .sa-emoji { flex: 0 0 64px; }
  .sr-controls .btn-sm, .sr-controls .btn-danger { flex: 1 1 auto; }
}

/* ── Motion: one orchestrated arrival, then stillness ──────────────────────── */
@keyframes fruit-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fruit { transform-origin: center; animation: fruit-pop .42s cubic-bezier(.2,1.5,.4,1) backwards; animation-delay: calc(.35s + var(--i) * .045s); }

@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.owl-pupil { animation: blink 6.5s ease-in-out infinite; transform-origin: center; }

@keyframes drift { 0%, 100% { transform: translate(0, 0); opacity: .85; } 50% { transform: translate(9px, -7px); opacity: .35; } }
.fireflies circle { animation: drift 7s ease-in-out infinite; }
.fireflies circle:nth-child(2) { animation-duration: 9s; animation-delay: -3s; }
.fireflies circle:nth-child(3) { animation-duration: 8s; animation-delay: -5s; }

@keyframes twinkle { 0%, 100% { opacity: .8; } 50% { opacity: .25; } }
.stars circle { animation: twinkle 5s ease-in-out infinite; }
.stars circle:nth-child(even) { animation-delay: -2.5s; }

@media (prefers-reduced-motion: reduce) {
  .fruit, .owl-pupil, .fireflies circle, .stars circle { animation: none; }
  .tile, .prize-card { transition: none; }
  .prize-card:hover { transform: none; }
}

@media (max-width: 520px) {
  .tree-caption { left: 14px; right: 14px; bottom: 12px; }
  .tree-sub { display: none; }
  .owl-plate { font-size: 10px; padding: 3px 8px; }
}
