/* Layout: the 3D garden fills the screen; a few dark moss-glass controls float over it.
   One visual world by choice: the sky behind changes with the hour, so the UI stays the same in every theme. */
:root {
  color-scheme: dark;
  --sky: #17283a;                         /* shown before WebGL paints */
  --glass: rgba(22, 44, 38, 0.74);
  --glass-solid: rgba(19, 38, 33, 0.92);
  --line: rgba(236, 248, 226, 0.16);
  --ink: #f2f7e8;
  --ink-soft: #b7cbb4;
  --leaf: #a6e06f;
  --leaf-ink: #15301c;
  --dew: #7fd2f7;
  --sun: #ffc94a;
  --nectar: #ff9db4;
  --plus: #cdb0ff;
  --stone: #b9b4ad;
  --font-display: 'Fredoka', 'Varela Round', ui-rounded, system-ui, sans-serif;
  --font-body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 18px;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--sky); color: var(--ink); font: 15px/1.45 var(--font-body); -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }

#hud { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#hud > * { pointer-events: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ico { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.15em; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; }
h2 { font: 600 1.25rem/1.2 var(--font-display); margin: 0; text-wrap: balance; }
p { margin: 0; }

/* Top bar */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.wallet { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.pill { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-variant-numeric: tabular-nums; }
.pill b { font: 600 1.05rem/1 var(--font-display); }
.pill small { color: var(--ink-soft); font-size: 0.72rem; }
.wallet.pulse .pill { animation: pulse 0.7s ease; }
@keyframes pulse { 30% { transform: scale(1.08); border-color: var(--leaf); } }
.round { width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); display: grid; place-items: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.round.small { width: 32px; height: 32px; background: transparent; font-size: 0.85rem; }
.round svg { width: 20px; height: 20px; }

/* Gather */
.bottom { display: flex; justify-content: center; }
.gather { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 26px; border-radius: 999px; background: var(--leaf); color: var(--leaf-ink);
  font: 600 1.15rem/1 var(--font-display); box-shadow: 0 8px 24px rgba(8, 24, 16, 0.35); transition: transform 0.2s ease, background 0.4s ease; }
.gather:hover { transform: translateY(-2px); }
.gather.empty { background: var(--glass); color: var(--ink-soft); border: 1px solid var(--line); box-shadow: none; font-weight: 500; }
.gather-amounts { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.gather .ico path, .gather .ico circle { fill: var(--leaf-ink); } .gather .ico g { stroke: var(--leaf-ink); }
.amt { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Sheet: side panel on wide screens, bottom sheet on phones */
.sheet { position: absolute; inset-inline-end: max(16px, env(safe-area-inset-right, 0px)); top: calc(66px + env(safe-area-inset-top, 0px)); width: min(360px, calc(100% - 32px));
  max-height: calc(100% - 170px); overflow: auto; padding: 16px; border-radius: var(--r); background: var(--glass-solid); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 40px rgba(6, 18, 14, 0.4); }
@media (max-width: 640px) {
  .sheet { top: auto; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); inset-inline: max(12px, env(safe-area-inset-left, 0px)); width: auto; max-height: 50%; }
  .pill small { display: none; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sheet-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.chip { padding: 2px 10px; border-radius: 999px; background: rgba(166, 224, 111, 0.16); color: var(--leaf); font-size: 0.8rem; }
.meta { color: var(--ink-soft); font-size: 0.85rem; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.per { color: var(--ink-soft); font-size: 0.8rem; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); }
.tabs button { flex: 1; padding: 7px 10px; border-radius: 999px; background: transparent; color: var(--ink-soft); font-family: var(--font-display); }
.tabs button[aria-selected="true"] { background: rgba(236, 248, 226, 0.14); color: var(--ink); }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main strong { font: 500 1rem/1.2 var(--font-display); }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 0.85rem; }
.cost.short { opacity: 0.5; }
.btn { padding: 7px 14px; border-radius: 999px; background: var(--leaf); color: var(--leaf-ink); font: 600 0.9rem/1 var(--font-display); white-space: nowrap; transition: opacity 0.3s; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.dim { opacity: 0.45; }
.btn.wide { align-self: stretch; padding-block: 10px; }
.btn.big { padding: 12px 28px; font-size: 1.05rem; align-self: center; }
.plus { color: var(--plus); border: 1px solid currentColor; border-radius: 999px; padding: 4px 10px; font: 500 0.8rem/1 var(--font-display); text-decoration: none; white-space: nowrap; }
.plus.block { align-self: flex-start; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.steps i { height: 6px; border-radius: 3px; background: rgba(236, 248, 226, 0.14); }
.steps i.done { background: var(--leaf); }
.steps i.now { background: linear-gradient(to right, var(--leaf) var(--p), rgba(236, 248, 226, 0.14) var(--p)); }
[dir="rtl"] .steps i.now { background: linear-gradient(to left, var(--leaf) var(--p), rgba(236, 248, 226, 0.14) var(--p)); }
.stats { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.stats div { display: flex; justify-content: space-between; gap: 12px; }
.stats dt { color: var(--ink-soft); } .stats dd { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.note { font-size: 0.85rem; color: var(--sun); }
.expand { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-block: 10px; border-block: 1px solid var(--line); }
.expand > div { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.9rem; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink-soft); }
select { font: inherit; color: var(--ink); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; }
.dev { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; margin: 0; font-size: 0.85rem; color: var(--ink-soft); min-width: 0; }
.dev legend { padding-inline: 6px; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.dev input[type="range"] { width: 100%; accent-color: var(--leaf); }
.check { display: flex; gap: 8px; align-items: center; } .check input { accent-color: var(--leaf); }
.dev .btn { align-self: flex-start; }

/* Cards and toasts */
.card { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); padding: 26px 24px; border-radius: 24px;
  background: var(--glass-solid); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 24px 60px rgba(6, 18, 14, 0.5); }
.card p { color: var(--ink-soft); }
.card .meta { justify-content: center; }
.eyebrow { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.haul { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; font: 600 1.5rem/1.2 var(--font-display); padding-block: 6px; }
#toasts { position: absolute; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { padding: 8px 16px; border-radius: 999px; background: var(--glass-solid); border: 1px solid var(--line); display: flex; gap: 10px; font-family: var(--font-display);
  animation: rise 0.35s ease; transition: opacity 0.5s, transform 0.5s; white-space: nowrap; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .gather, .toast, .wallet.pulse .pill { animation: none; transition: none; } }

/* Flower Show */
.show { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-bottom, 0px));
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.show > * { pointer-events: auto; }
.show-top { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.show-top h2 { margin-inline-end: auto; text-shadow: 0 1px 10px rgba(6, 18, 14, 0.5); }
.show-tabs { width: auto; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.show-tabs button { padding-inline: 16px; }
.show-panel { align-self: center; width: min(460px, 100%); padding: 16px; border-radius: var(--r); background: var(--glass-solid); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 16px 40px rgba(6, 18, 14, 0.4); }
.show-info { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.show-info > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.show-info strong, .board strong { font: 600 1.1rem/1.2 var(--font-display); }
.votes { display: inline-flex; align-items: center; gap: 6px; color: var(--nectar); font: 600 1.1rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.show-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.chip.dim { background: rgba(236, 248, 226, 0.1); color: var(--ink-soft); }
.week { justify-content: center; }
.board { list-style: none; margin: 0; padding: 0; max-height: min(320px, 38vh); overflow: auto; }
.board button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 4px; background: transparent; border-top: 1px solid var(--line); text-align: start; }
.board li:first-child button { border-top: 0; }
.board .grow { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rank { width: 1.5em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.show-links { display: flex; flex-wrap: wrap; gap: 8px; }
[dir="rtl"] .chev { transform: scaleX(-1); }
.showing .top, .showing .bottom, .showing .sheet, .showing .card { display: none; }
.showing #toasts { bottom: calc(200px + env(safe-area-inset-bottom, 0px)); }
.tabs button { white-space: nowrap; }

/* Stars and Starlight */
.pill.star { color: var(--sun); border-color: rgba(255, 201, 74, 0.35); }
.pill.star .glyph { font-size: 1rem; line-height: 1; }
.pill.star b { color: var(--ink); }
.star-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255, 201, 74, 0.07); border: 1px solid rgba(255, 201, 74, 0.25); }
.star-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.star-head strong { font: 600 1.05rem/1.2 var(--font-display); color: var(--sun); }
.bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.track { height: 7px; border-radius: 4px; background: rgba(236, 248, 226, 0.14); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(to right, var(--sun), #fff1b8); transition: width 0.5s ease; }
[dir="rtl"] .track i { background: linear-gradient(to left, var(--sun), #fff1b8); }
.bar small { color: var(--ink-soft); font-size: 0.72rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); }
.reqs li { display: flex; align-items: center; gap: 8px; }
.reqs li.ok { color: var(--leaf); }
.tick { width: 1em; height: 1em; flex: none; }
.star-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.star-actions .btn:last-child:not([disabled]) { background: var(--sun); color: #3a2a05; }

/* decorations */
.row.locked { opacity: 0.6; }
.chip.lock { color: var(--ink-soft); }
.hint { margin: 8px 2px 0; }
.rows { max-height: min(46vh, 420px); overflow-y: auto; }
.costs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px; }
.acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }

.legal { margin: 12px 0 0; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--ink-soft); font: inherit; font-size: 0.85rem; text-decoration: underline; cursor: pointer; }
.danger { padding: 10px 12px; border-radius: 12px; background: rgba(214, 90, 90, 0.12); }
.btn.warn { background: #d65a5a; color: #fff; }
