/* Bloom v3: cozy farm pixel art. A parchment menu board in a wooden frame over a flowery meadow,
   a fenced plot of tilled soil, and a seed packet for the result.
   All pixel sprites come from art.js as CSS variables (--px-*), so day and night swap palettes in one place. */
:root {
  --ink: #3E2410; --muted: #7A5532; --line: #C9A46A; --paper: #FBE6B6; --paper-2: #F3D89E;
  --thorn: #3B2A22; --cursor: #FFE36A; --gold: #FFE36A;
  --w0: #E0483C; --w1: #9A4FD0; --w2: #3550A8; --w3: #E8A814;
  --accent: #F0507A; --em: #B8284F; --accent-ink: #FFFFFF; --off-ink: #5A3A1E; --shadow: #4A2410; --dim: rgba(74, 36, 16, .18);
  --logo: "Pixelify Sans", "Courier New", monospace; /* only the wordmark */
  --display: "Tiny5", "Courier New", monospace;
  --body: "Tiny5", "Courier New", monospace;
  --mono: "Tiny5", "Courier New", monospace;
  --px: 3px; /* one art pixel on frames and buttons */
  --tick: 110ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F4E4C6; --muted: #BFA27E; --line: #5A4030; --paper: #2A2124; --paper-2: #221A1D;
    --thorn: #120C0C; --accent: #FF6F98; --em: #FF9DBA; --off-ink: rgba(244, 228, 198, .55); --shadow: #050306; --dim: rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #F4E4C6; --muted: #BFA27E; --line: #5A4030; --paper: #2A2124; --paper-2: #221A1D;
  --thorn: #120C0C; --accent: #FF6F98; --em: #FF9DBA; --off-ink: rgba(244, 228, 198, .55); --shadow: #050306; --dim: rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink); font: 400 16px/1.45 var(--body); letter-spacing: .02em; }
body { background: var(--px-meadow) 0 0 / 192px 192px; image-rendering: pixelated; min-height: 100vh; position: relative; }
#app {
  position: relative; z-index: 1;
  max-width: 470px; margin: 14px auto 28px; padding: 4px 12px 18px; display: flex; flex-direction: column; gap: 10px;
  border-style: solid; border-width: calc(var(--px) * 5);
  border-image: var(--px-frame) 5 fill / calc(var(--px) * 5) stretch;
  filter: drop-shadow(0 calc(var(--px) * 2) 0 rgba(30, 14, 4, .35));
}
* { font-synthesis: none; }
b, strong { font-weight: 400; }
.card p b, .rule b { color: var(--em); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px dashed var(--em); outline-offset: 3px; }
.cell:focus-visible, .card:focus-visible { outline: none; }
/* board focus: a white-and-black double ring drawn above the tile art, visible on every tile */
.cell .focusring { position: absolute; inset: 0; z-index: 7; pointer-events: none; display: none; box-shadow: inset 0 0 0 3px #FFFFFF, inset 0 0 0 6px #1A0E06; }
.cell:focus-visible .focusring { display: block; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: pre; }
svg { display: block; width: 100%; height: 100%; }

/* night fireflies (dark theme only) */
.fireflies { position: fixed; inset: 0; pointer-events: none; z-index: 0; display: none; }
.fireflies i { position: absolute; width: 4px; height: 4px; background: #FFF3A0; box-shadow: 0 0 0 2px rgba(255, 240, 140, .25); animation: firefly 3.2s steps(8) infinite; opacity: 0; }
@keyframes firefly { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 60% { opacity: .8; transform: translate(8px, -10px); } 100% { opacity: 0; transform: translate(14px, -4px); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fireflies { display: block; } }
:root[data-theme="dark"] .fireflies { display: block; }

/* reusable pixel buttons */
.primary, .ghost, .icon {
  border-style: solid; border-width: calc(var(--px) * 3) calc(var(--px) * 3) calc(var(--px) * 5);
  border-image: var(--px-btn2) 3 3 5 3 fill / calc(var(--px) * 3) calc(var(--px) * 3) calc(var(--px) * 5) stretch;
}
.primary:active:not(:disabled), .ghost:active:not(:disabled), .icon:active {
  border-width: calc(var(--px) * 5) calc(var(--px) * 3) calc(var(--px) * 3);
  border-image: var(--px-btn2-down) 5 3 3 3 fill / calc(var(--px) * 5) calc(var(--px) * 3) calc(var(--px) * 3) stretch;
}
.primary { border-image-source: var(--px-btn); color: var(--accent-ink); text-shadow: 0 2px 0 #9A2246; }
.primary:active:not(:disabled) { border-image-source: var(--px-btn-down); }
.primary:disabled, .ghost:disabled { border-image-source: var(--px-btn-off); color: var(--off-ink); text-shadow: none; cursor: default; }
@media (hover: hover) { .primary:hover:not(:disabled), .ghost:hover:not(:disabled), .icon:hover { filter: brightness(1.06); } }

/* header: the name on a wooden plank sign */
.top { display: grid; grid-template-columns: 50px minmax(0, 1fr) 50px; align-items: start; gap: 6px; }
.title { text-align: center; display: flex; flex-direction: column; align-items: center; }
.sign { padding: 2px 14px 4px; border-style: solid; border-width: calc(var(--px) * 4); border-image: var(--px-sign) 4 fill / calc(var(--px) * 4) stretch; filter: drop-shadow(0 3px 0 rgba(30, 14, 4, .35)); }
.wordmark {
  margin: 0; font: 700 min(46px, calc((100vw - 170px) * .185))/1 var(--logo); letter-spacing: 1px; color: #FFF1D0; display: inline-flex; align-items: center;
  text-shadow: 3px 0 0 #3A1C0C, -3px 0 0 #3A1C0C, 0 3px 0 #3A1C0C, 0 -3px 0 #3A1C0C, 3px 3px 0 #3A1C0C, -3px 3px 0 #3A1C0C, 3px -3px 0 #3A1C0C, -3px -3px 0 #3A1C0C, 0 6px 0 #3A1C0C, 3px 6px 0 #3A1C0C, -3px 6px 0 #3A1C0C;
}
.wordmark .o { display: inline-block; width: .86em; height: .86em; margin: 0 .02em; animation: sway 2.4s steps(1) infinite; filter: drop-shadow(3px 0 0 #3A1C0C) drop-shadow(-3px 0 0 #3A1C0C) drop-shadow(0 3px 0 #3A1C0C); }
@keyframes sway { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 50% { transform: rotate(0); } 75% { transform: rotate(8deg); } }
.sub { color: var(--muted); font: 400 15px/1 var(--body); display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 8px; font-variant-numeric: tabular-nums; }
.nav { color: var(--ink); font: 400 22px/1 var(--display); padding: 0 8px; min-width: 44px; min-height: 44px; }
.nav:disabled { opacity: .25; cursor: default; }
.icon { width: 50px; height: 54px; padding: 0; display: grid; place-items: center; margin-top: 8px; }
.icon span { width: 30px; height: 30px; }

.rule { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; color: var(--muted); text-align: center; width: 100%; padding: 4px; cursor: pointer; }
.rule .ruleinfo { display: inline-grid; place-items: center; width: 20px; height: 20px; font: 400 14px/1 var(--display); color: var(--paper); background: var(--em); box-shadow: 0 0 0 2px var(--shadow); }
@media (hover: hover) { .rule:hover b { text-decoration: underline; } }
.rule b { color: var(--em); font: 400 18px var(--display); }
.chip { font: 400 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; color: #FBE6B6;
  border-style: solid; border-width: 6px; border-image: var(--px-chip) 2 fill / 6px stretch; }

/* HUD: seed bags to plant, watering cans = Blooms left */
.hud { display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 2px 6px;
  border-style: solid; border-width: 6px; border-image: var(--px-slot) 2 fill / 6px stretch; }
.seeds { display: flex; gap: 0; }
.seeds span { width: 32px; height: 32px; transition: opacity .2s; }
.seeds span.used { opacity: .28; filter: grayscale(1) brightness(1.4); }
.attempts { display: flex; gap: 0; align-items: center; }
.attempts::before { content: "Blooms"; font: 400 12px var(--mono); text-transform: uppercase; color: #E9C98E; margin-right: 6px; }
.attempts span { width: 26px; height: 26px; }
@media (max-width: 360px) { .attempts span { width: 22px; height: 22px; } .attempts::before { margin-right: 2px; } }
.attempts span.used { opacity: .3; filter: grayscale(1); }

/* board: a fenced plot of tilled soil */
.boardwrap { position: relative; width: min(100%, max(280px, calc(100svh - 190px))); margin-inline: auto; } /* the whole board fits on short/landscape screens */
.board {
  display: grid; gap: 2px; padding: 2px; user-select: none; touch-action: manipulation;
  border-style: solid; border-width: calc(var(--px) * 4); border-image: var(--px-board) 5 fill / calc(var(--px) * 4) stretch;
}
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); background: var(--paper); font: 400 17px var(--display); }
.cell { position: relative; aspect-ratio: 1; max-width: 100%; background: var(--px-soil0) 0 0 / 100% 100%; display: grid; place-items: center; overflow: hidden; image-rendering: pixelated; }
.cell.v1 { background-image: var(--px-soil1); }
.cell.v2 { background-image: var(--px-soil2); }
.cell.sand { background-image: var(--px-sand); }
.cell.stone::before { content: ""; position: absolute; inset: 0; background: var(--px-stone) center / 100% 100%; }
.cell.stone.s1::before { background-image: var(--px-stone2); }
.cell .glyph { position: relative; z-index: 2; width: 92%; height: 92%; display: grid; place-items: center; pointer-events: none; }
.cell .glyph:not(:empty)::before { /* soft pixel shadow under every plant */
  content: ""; position: absolute; left: 6%; right: 6%; bottom: -4%; height: 24%; background: var(--px-shadow) center / 100% 100%; z-index: -1;
}
.cell .fill { position: absolute; inset: 0; transform: scale(0); opacity: 0; z-index: 1; }
.cell.grown .fill { transform: none; opacity: 1; animation: grow 240ms steps(3, end) backwards; animation-delay: var(--d, 0ms); } /* end state lives in the rule, so a paused or skipped animation still leaves a full tile (iOS Safari) */
.cell.o1 .fill { background: var(--px-grass0) 0 0 / 100% 100%; }
.cell.o1.v1 .fill { background-image: var(--px-grass1); }
.cell.o1.v2 .fill { background-image: var(--px-grass2); }
.cell.o2 .fill { background: var(--px-weed0) 0 0 / 100% 100%; }
.cell.o3 .fill { background: var(--px-weed1) 0 0 / 100% 100%; }
.cell.o4 .fill { background: var(--px-weed2) 0 0 / 100% 100%; }
.cell.o5 .fill { background: var(--px-weed3) 0 0 / 100% 100%; }
.cell.thorn .fill { background: var(--px-thorns) center / 100% 100%, var(--thorn); }
.cell.weed .fill { animation: none; transform: scale(1); opacity: 1; }
.cell.weed .glyph { width: 90%; height: 90%; }
.cell.settled .fill, .cell.settled .glyph { animation: none !important; }
.cell.won .glyph { transform: scale(1.1); animation: pop 480ms steps(4, end) backwards; animation-delay: var(--d, 0ms); }
.cell.lost .glyph { transform: scale(.82) translateY(8%); filter: sepia(1) saturate(.8) brightness(.72); opacity: .85; animation: wilt 420ms steps(3, end) backwards; animation-delay: var(--d, 0ms); }
.cell.seed::after { /* farm-style tile cursor: four bright corner brackets */
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: var(--px-cursor) center / 100% 100%;
  animation: breathe 1s steps(1) infinite;
}
.cell.seed.grown::after { animation: none; opacity: .85; }
@keyframes breathe { 50% { transform: scale(.9); } }
.cell.seed:not(.grown) .glyph { animation: plant 240ms steps(3, end); }
.cell.pulse::after { content: ""; position: absolute; inset: 0; z-index: 3; background: var(--px-cursor) center / 100% 100%; animation: blink 700ms steps(1) infinite; }
.cell .clock { position: absolute; right: 1px; bottom: 1px; min-width: 14px; padding: 0 2px; text-align: center; font: 400 12px/13px var(--mono); color: #3E2410; background: #FBE6B6; box-shadow: 0 0 0 1px #3A1C0C; z-index: 3; }
.board.planning .cell:not(.stone):not(.weed) { cursor: pointer; }
.board.planning .cell:not(.stone):not(.weed):not(.seed):hover::after { content: ""; position: absolute; inset: 0; z-index: 3; background: var(--px-cursor) center / 100% 100%; opacity: .5; }
.petal { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--c, #FF7FA8); box-shadow: 1px 1px 0 rgba(0,0,0,.3); z-index: 4; pointer-events: none; animation: burst 640ms steps(6, end) forwards; }
.sparkle { position: absolute; left: 50%; top: 40%; width: 60%; aspect-ratio: 1; transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
  background: var(--px-sparkle) 0 0 / 400% 100%; animation: sparkle 480ms steps(4, jump-none) forwards; }
@keyframes sparkle { from { background-position: 0 0; } to { background-position: 100% 0; } }

@keyframes grow { from { transform: scale(0); opacity: 0; } }
@keyframes pop { 0% { transform: translateY(0); } 33% { transform: scale(1.25) translateY(-14%); } 66% { transform: scale(1.08) translateY(-4%); } 100% { transform: scale(1.1); } }
@keyframes wilt { from { transform: none; filter: none; opacity: 1; } }
@keyframes plant { from { transform: scale(.3) translateY(30%); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes burst { to { transform: translate(var(--x), var(--y)); opacity: 0; } }

/* legend */
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 15px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 2px; background: var(--px-soil0) 0 0 / 100% 100%; box-shadow: 0 0 0 2px var(--shadow); }
.legend i + i { margin-left: 4px; }
.legend i.w2 { background-image: var(--px-weed0); }
.legend i.w3 { background-image: var(--px-weed1); }
.legend i.w4 { background-image: var(--px-weed2); }
.legend i.w5 { background-image: var(--px-weed3); }
.legend i.th { background: var(--px-thorns) center / 100% 100%, var(--thorn); }
.legend i.me { background-image: var(--px-grass0); }
.legend i.bl { width: 24px; height: 24px; padding: 0; background: none; box-shadow: none; }

/* score: a wooden counter and a segmented growth bar */
.scoreline { display: flex; align-items: center; gap: 12px; min-height: 72px; }
.score { width: 78px; height: 70px; flex: none; display: grid; place-items: center;
  border-style: solid; border-width: calc(var(--px) * 3); border-image: var(--px-slot) 2 fill / calc(var(--px) * 3) stretch; }
#scoreNum { font: 400 32px/1 var(--display); color: var(--gold); text-shadow: 2px 2px 0 #2A160A; font-variant-numeric: tabular-nums; }
#scoreNum:empty::before { content: "--"; color: #B08A62; }
.scoretext { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.scoretext small { font: 400 12px var(--mono); color: var(--muted); }
.bar { height: 20px; position: relative; border-style: solid; border-width: 6px; border-image: var(--px-slot) 2 fill / 6px stretch; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .35s steps(10, end);
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(40, 10, 20, .55) calc(10% - 2px) 10%), linear-gradient(#FFB0C8 0 2px, var(--accent) 2px calc(100% - 2px), #B0244E calc(100% - 2px));
  background-size: calc(100% * 100 / var(--w, 100)) 100%, 100% 100%; }
.hint { color: var(--ink); font-size: 17px; }

/* buttons */
.actions, .row { display: flex; gap: 10px; }
.primary, .ghost { flex: 1; padding: 4px 8px; min-height: 58px; font: 400 19px var(--display); }
.ghost { color: var(--ink); }
.ghost[aria-pressed="true"]:not(:disabled) { border-image-source: var(--px-btn-on); color: #FFFDE8; text-shadow: 2px 2px 0 #1E3A12; }

/* finished panel: a seed packet */
.done { display: flex; flex-direction: column; gap: 12px; }
.packet { position: relative; padding: 18px 14px 14px; color: #3E2410;
  background: linear-gradient(#FFF6DC, #FFF6DC) padding-box;
  border-style: solid; border-width: calc(var(--px) * 5); border-image: var(--px-paper) 5 fill / calc(var(--px) * 5) stretch; }
.packet::before { /* perforated tear line */
  content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 4px; background: repeating-linear-gradient(90deg, #C9A46A 0 6px, transparent 6px 12px);
}
.packet-head { display: flex; justify-content: space-between; font: 400 12px var(--mono); text-transform: uppercase; color: #FFF1D0; margin: -4px -6px 10px; padding: 5px 8px;
  background: repeating-linear-gradient(90deg, #F0507A 0 12px, #E8436F 12px 24px); box-shadow: 0 3px 0 #9A2246, 0 -3px 0 #FF9DBA inset; text-shadow: 1px 1px 0 #7A1A3A; }
.packet-top { display: grid; grid-template-columns: 76px 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.packet-art { width: 76px; height: 76px; padding: 6px; background: var(--px-grass1-day) 0 0 / 100% 100%; box-shadow: 0 0 0 3px #3A1C0C, 4px 4px 0 3px rgba(58, 28, 12, .3); image-rendering: pixelated; }
.packet-name { display: flex; flex-direction: column; min-width: 0; }
.packet-name b { font: 400 24px/1.1 var(--display); color: #B8284F; }
.packet-name span { font-size: 15px; color: #7A5532; }
.packet .try b { color: #3E2410; }
.packet-name .streak { font: 400 12px var(--mono); color: #C25A16; text-transform: uppercase; margin-top: 2px; }
.packet-name .streak:not(:empty)::before { content: "\2605 "; }
.stamp { width: 70px; height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #B8284F; transform: rotate(-8deg);
  border: 3px dashed #B8284F; outline: 3px solid #B8284F; outline-offset: 3px; background: rgba(240, 80, 122, .08); }
.stamp small { font: 400 12px var(--mono); text-transform: uppercase; }
.stamp b { font: 400 28px/1 var(--display); }
.stamp.gold { color: #C47A00; border-color: #D99800; outline-color: #D99800; background: rgba(255, 210, 60, .18); }
.tries { display: flex; flex-direction: column; gap: 6px; }
.try { display: grid; grid-template-columns: 18px 1fr 34px; align-items: center; gap: 8px; }
.try .tn { font: 400 12px var(--mono); color: #9A7246; text-align: center; }
.try b { font: 400 19px var(--display); text-align: right; color: #3E2410; }
.try.best b { color: #F0507A; }
.plot { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 2px; background: #5C3218; box-shadow: 0 0 0 2px #3A1C0C; }
.plot i { aspect-ratio: 1; background: var(--px-soil0-day) 0 0 / 100% 100%; image-rendering: pixelated; display: grid; place-items: center; }
.plot i.on { background-image: var(--px-grass0-day); }
.plot i.pf { background-image: var(--px-grass1-day); }
.tries .more { margin: 0; font: 400 12px var(--mono); color: #7A5532; text-align: center; }
#shareText:not(.sr) { white-space: pre-wrap; margin: 0; padding: 8px; background: #FFF6DC; color: #3E2410; font: 400 14px/1.4 var(--body); user-select: all; }
.plot i svg { width: 86%; height: 86%; }
.next { margin: 0; color: var(--muted); font: 400 12px var(--mono); text-align: center; }

/* Daily / Unlimited switch and the Bloom+ difficulty row */
.modebar, .levelbar { display: flex; gap: 8px; justify-content: center; }
.modebar .tog { flex: 1 1 0; min-height: 40px; padding: 0 12px; }
.levelbar .tog { min-height: 38px; padding: 0 8px; font-size: 15px; }
.levelbar #btnNewGarden { flex: 1.4 1 0; }
.codebar { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: center; font-size: 15px; margin-top: -4px; }
.acctbar { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; justify-content: center; font-size: 15px; margin-top: -4px; text-align: center; }
.acctbar .linkbtn { min-height: 32px; }
.acctbar .muted { font-size: 14px; }
.acctwho { overflow-wrap: anywhere; }
.codebar b { font: 400 16px var(--mono); letter-spacing: .04em; }
#gardenInput { text-transform: uppercase; font-family: var(--mono); letter-spacing: .06em; }
.plusbadge { display: inline-block; min-width: 18px; padding: 0 4px; line-height: 18px; font: 400 13px var(--mono); text-align: center; color: #3E2410; background: #FFE36A; box-shadow: 0 2px 0 #B8860B; text-shadow: none; }
.plusbadge.big { padding: 2px 8px; font-size: 14px; }
.attempts .inf { font: 400 16px var(--mono); color: #FFE36A; margin-left: 2px; }

/* links that look like text */
.linkbtn { display: inline-flex; align-items: center; min-height: 40px; vertical-align: middle; padding: 0; color: var(--em); text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.linkbtn.danger { color: #C0392B; }
.small { font-size: 13px; }
.center { text-align: center; }
.tipline { margin: 6px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* ad slot: below the game, never over the board */
.adslot { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 120px; }
.adslot:has(ins[data-ad-status="unfilled"]) { display: none; }
.adlabel { font: 400 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.adbox { width: 100%; min-height: 90px; }
.adfake { height: 90px; display: grid; place-items: center; border: 2px dashed var(--line); color: var(--muted); font-size: 14px; }
.adslot .linkbtn { font-size: 13px; }

.foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); display: inline-flex; align-items: center; min-height: 40px; }
.foot .linkbtn { color: var(--muted); }

/* Bloom+ and sign-in */
.perks { margin: 8px 0; padding-left: 20px; }
.perks li { margin: 6px 0; }
.perks b, .plusstatus { color: var(--em); }
.plusstatus { font-size: 17px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field input { font: 400 18px var(--body); padding: 10px; color: #3E2410; background: #FFF6DC; border: 3px solid var(--line); border-radius: 0; min-height: 48px; width: 100%; }
.field input:focus { outline: 3px dashed var(--em); outline-offset: 2px; }
.botcheck:empty { display: none; }
.botcheck { display: flex; justify-content: center; margin: 4px 0; min-height: 0; }
.formerr { color: #C0392B; margin: 4px 0; font-size: 15px; }
.acct { margin-top: 4px; }
.acct .acctrow { align-items: center; gap: 14px; }
.acct .acctrow .ghost.sm { flex: 0 0 auto; min-height: 44px; padding: 0 16px; font-size: 16px; }
.plusline .linkbtn { margin-left: 4px; }
.demobar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 6px 12px; text-align: center; font-size: 13px; background: #3E2410; color: #FBE6B6; }

/* sound toggles */
.soundbar { display: flex; flex-wrap: wrap; gap: 8px; }
.tog { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 6px; color: var(--ink);
  border-style: solid; border-width: calc(var(--px) * 2) calc(var(--px) * 2) calc(var(--px) * 4);
  border-image: var(--px-btn2) 3 3 5 3 fill / calc(var(--px) * 2) calc(var(--px) * 2) calc(var(--px) * 4) stretch; }
.tog span[data-icon] { width: 24px; height: 24px; }
.tog[aria-pressed="true"] { border-image-source: var(--px-btn-on); color: #FFFDE8; text-shadow: 0 2px 0 #1E3A12; }
.tog[aria-pressed="false"] span[data-icon] { opacity: .45; filter: grayscale(1); }
.soundbar .tog[aria-pressed="false"] .lbl { text-decoration: line-through; text-decoration-thickness: 2px; }

/* modals: a menu board */
.modal { position: fixed; inset: 0; background: rgba(20, 10, 4, .6); display: grid; place-items: center; padding: 12px; z-index: 30; }
.card { max-width: 430px; width: 100%; max-height: 92vh; overflow: auto; padding: 6px 12px 12px; color: var(--ink);
  border-style: solid; border-width: calc(var(--px) * 5); border-image: var(--px-frame) 5 fill / calc(var(--px) * 5) stretch; }
.card h2 { margin: 0 0 6px; font: 400 28px var(--display); color: var(--em); }
.card h3 { margin: 14px 0 2px; font: 400 19px var(--display); }
.card p { margin: 8px 0; }
.ii { display: inline-block; width: 1.4em; height: 1.4em; vertical-align: -.35em; }
.keyrow { display: flex; gap: 14px; font: 400 17px var(--display); }
.keyrow > span { display: inline-flex; align-items: center; gap: 3px; }
.muted { color: var(--muted); font-size: 15px; }
.board.small { max-width: 300px; margin: 12px auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 6px; }
.stats div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stats b { display: block; width: 100%; font: 400 28px/1.2 var(--display); color: var(--gold); text-shadow: 2px 2px 0 #2A160A;
  border-style: solid; border-width: 6px; border-image: var(--px-slot) 2 fill / 6px stretch; }
.stats span { font: 400 12px var(--mono); color: var(--muted); text-transform: uppercase; }
.herbarium { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0 14px; }
.herbarium button { position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 3px; background: var(--px-soil1) 0 0 / 100% 100%; box-shadow: 0 0 0 2px var(--shadow); image-rendering: pixelated; }
.herbarium button:not(.tried):not(.got) { opacity: .55; }
.herbarium button svg { width: 84%; height: 84%; }
.herbarium button small { font: 400 12px var(--mono); color: #FFF6DC; text-shadow: 1px 1px 0 #2A160A, -1px -1px 0 #2A160A; }
.herbarium button.got { background: #FFF6DC; box-shadow: 0 0 0 2px var(--shadow), 2px 2px 0 2px rgba(0,0,0,.2); transform: rotate(-2deg); }
.herbarium button.got:nth-child(even) { transform: rotate(2deg); }
.herbarium button.got::after { content: ""; position: absolute; left: -4px; top: -3px; width: 18px; height: 9px; background: var(--px-tape) 0 0 / 100% 100%; }
.herbarium button.here { outline: 3px solid var(--em); outline-offset: 2px; }
.herbarium button:focus-visible { outline: 3px dashed var(--ink); outline-offset: 2px; }
.toast { position: fixed; left: 50%; top: calc(18px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); max-width: calc(100vw - 24px); text-align: center; color: var(--ink); padding: 2px 10px; font: 400 16px var(--display); z-index: 60;
  border-style: solid; border-width: calc(var(--px) * 4); border-image: var(--px-frame) 5 fill / calc(var(--px) * 4) stretch; }

#dayLabel { white-space: nowrap; }
@media (max-width: 360px) { .sub { font-size: 13px; gap: 0; } .sub .nav { min-width: 32px; } }
@media (max-width: 400px) {
  :root { --px: 2px; }
  #app { margin: 0; padding: 2px 6px 14px; }
  .board { gap: 1px; padding: 1px; }
  .packet-top { grid-template-columns: 60px 1fr auto; }
  .packet-art { width: 60px; height: 60px; }
  .stamp { width: 60px; height: 60px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell .fill, .cell .glyph, .petal, .sparkle, .wordmark .o, .cell.pulse::after, .cell.seed::after, .fireflies i { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

/* print: keep the pixel art and hide the controls */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: none; }
  .soundbar, .modebar, .levelbar, .codebar, .adslot, .foot, .demobar, .actions, .done .row, .fireflies, .toast, .modal { display: none !important; }
  #app { margin: 0 auto; filter: none; break-inside: avoid; }
}
/* Windows high-contrast: keep text on the system colours and give buttons a plain border */
@media (forced-colors: active) {
  .primary, .ghost, .icon, .tog, .chip, .primary:disabled, .ghost:disabled, .ghost[aria-pressed="true"], .tog[aria-pressed="true"], .primary:active, .ghost:active { border: 2px solid ButtonText !important; border-image: none !important; background: ButtonFace !important; color: ButtonText !important; }
  .cell { forced-color-adjust: none; }
}

/* sand and stone keys (legend and help) */
.legend i.sd, .ii.tile-sand { background: var(--px-sand) 0 0 / 100% 100%; }
.legend i.sn, .ii.tile-stone { background: var(--px-stone) center / 100% 100%, var(--px-soil0) 0 0 / 100% 100%; }
.ii.tile-sand, .ii.tile-stone { box-shadow: 0 0 0 2px var(--shadow); image-rendering: pixelated; }

/* today's garden card */
.daycard { text-align: center; }
.daytop { display: flex; justify-content: space-between; align-items: center; font: 400 13px var(--mono); color: var(--muted); }
.daycard h2 { font-size: 34px; margin: 6px 0 4px; }
.dayart { display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.tilekey { display: inline-grid; place-items: center; width: 52px; height: 52px; padding: 4px; background: var(--px-soil0) 0 0 / 100% 100%; box-shadow: 0 0 0 3px var(--shadow); image-rendering: pixelated; }
.tilekey.sd { background-image: var(--px-sand); }
.tilekey.sn { background: var(--px-stone) center / 100% 100%, var(--px-soil0) 0 0 / 100% 100%; }
.tilekey.ck { font: 400 22px var(--mono); color: #FFF6DC; text-shadow: 2px 2px 0 #2A160A, -1px -1px 0 #2A160A, 1px -1px 0 #2A160A, -1px 1px 0 #2A160A; } /* readable on day and night soil */
.tilekey.ck::after { content: ""; }
.daytext { font-size: 17px; margin: 6px 0 10px; }
.dayfacts { list-style: none; padding: 8px 10px; margin: 0 0 10px; text-align: left; display: grid; gap: 4px; background: var(--dim); }
.dayfacts li::before { content: "\2022  "; color: var(--em); }
.dayfacts b { color: var(--em); font-weight: 400; }
.daytip { font-size: 15px; color: var(--muted); margin: 0 0 12px; }
.daytip::before { content: "Tip: "; color: var(--em); }

/* help: animated guide */
.demo { margin: 2px 0 8px; }
.demo-top { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.demo-top b { font: 400 19px var(--display); color: var(--em); }
.demo-top .fri { margin-left: auto; }
.demo-stage { position: relative; width: min(100%, 250px); margin: 6px auto 2px; }
.board.demo-board { pointer-events: none; }
.demo-call { position: absolute; z-index: 9; transform: translate(-50%, calc(-100% - 2px)); white-space: nowrap; padding: 0 6px; font: 400 15px/1.4 var(--display); color: #FFFDE8; background: var(--em); box-shadow: 0 0 0 2px var(--shadow), 2px 2px 0 2px rgba(0,0,0,.25); pointer-events: none; animation: callpop 300ms steps(3, end); }
@keyframes callpop { from { transform: translate(-50%, -60%) scale(.6); opacity: 0; } }
.demo-cap { min-height: 5.8em; margin: 6px 0 4px !important; font-size: 15px; line-height: 1.45; text-align: center; }
.demo-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.demo-nav .ghost.sm { flex: 0 0 52px; min-height: 42px; font-size: 22px; padding: 0; }
.dots { display: flex; gap: 8px; }
.dots .dot { width: 14px; height: 14px; padding: 0; background: var(--muted); opacity: .45; box-shadow: 0 0 0 2px var(--shadow); }
.dots .dot[aria-current="step"] { background: var(--em); opacity: 1; }
.rules { margin: 6px 0 10px; }
.rules summary { cursor: pointer; font: 400 17px var(--display); color: var(--em); padding: 4px 0; }
@media (prefers-reduced-motion: reduce) { .demo-call { animation: none; } }
