/* Hallmark · shape: app screen · genre: playful · theme: Hum (deal 1/3, seed garden-block-puzzle-game-56be·16838639·2026-12-02·r0)
 * nav: top bar per screen (home, map, game) · signature: the garden bed, seeds blooming as lines clear · states: locked, current, done, dead piece, win, out of moves, no room, ad break
 * axes: light/rounded-sans/chromatic-yellow · posture: full-palette · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4 · weakest: H, home is a title screen so the bed preview carries it */
/* waive: fonts, system rounded stack instead of Chillax because the user asked for super lightweight and no font download */
@import url("./tokens.css");
@import url("./base.css");

:root {
  /* one cheap tile of paper grain, used on the page ground only (per-cell filters cost frame time) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --cell: clamp(30px, min(calc((100vw - 72px) / 8), calc((100dvh - 330px) / 8)), 58px);
  --gap: 4px;
  --soil: color-mix(in oklab, var(--color-kraft) 70%, var(--color-ink));
  --plot: color-mix(in oklab, var(--color-kraft) 30%, var(--color-paper-2));
  --scrim: color-mix(in oklab, var(--color-ink) 45%, transparent);
  --shine: color-mix(in oklab, var(--color-fringe) 55%, transparent);
}

body { background: var(--grain), var(--color-paper); min-height: 100dvh; }
button { cursor: pointer; color: inherit; }
.muted { color: var(--color-muted); }
.note { color: var(--color-ink-2); min-height: 1.5em; text-align: center; }

/* ---------- controls: card stock ---------- */
.btn { --edge: 5px; border: 0; border-radius: var(--radius-stock); min-height: 54px; padding: 0 var(--space-lg); font-weight: 600; font-size: var(--text-lg); background: var(--color-card); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-rule), 0 var(--edge) 0 0 var(--color-edge); transition: translate var(--dur-micro) var(--ease-snap), box-shadow var(--dur-micro) var(--ease-snap); touch-action: manipulation; }
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: 0 var(--edge) 0 0 var(--color-accent-deep); transition-timing-function: var(--ease-spring); }
.btn:hover { --edge: 7px; translate: 0 -2px; }
.btn:active { --edge: 1px; translate: 0 4px; }
.btn:focus-visible, .link:focus-visible, .slot:focus-visible, .packet:focus-visible, .board:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; transition: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; translate: none; --edge: 3px; }
.btn--small { min-height: 44px; font-size: var(--text-md); padding: 0 var(--space-md); --edge: 4px; }
.btn--small:hover { --edge: 6px; }
.ad-tag { font-size: var(--text-xs); font-weight: 500; padding: var(--space-3xs) var(--space-xs); border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-ink-2); }
.link { background: none; border: 0; padding: var(--space-xs); font-weight: 500; color: var(--color-accent-2); text-decoration: underline; text-underline-offset: 0.2em; min-height: 44px; }
.link:hover { color: var(--color-ink); }

/* ---------- screens ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: var(--space-lg); padding: var(--space-lg) var(--space-md) var(--space-xl); max-width: 560px; margin-inline: auto; }
.bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.bar h2 { font-size: var(--text-xl); text-align: center; flex: 1; max-width: none; }

.home { justify-content: center; text-align: center; }
.title { font-size: calc(var(--text-3xl) * 1.9); max-width: none; color: var(--color-ink); }
.home .lead { margin-inline: auto; color: var(--color-ink-2); font-size: var(--text-lg); }
.actions { display: grid; gap: var(--space-md); width: min(100%, 320px); }

.garden { width: 100%; background: var(--color-hill-2); border-radius: var(--radius-card); padding: var(--space-lg) var(--space-lg) 0; display: grid; gap: var(--space-2xs); overflow: hidden; }
.garden h2 { font-size: var(--text-xl); margin-inline: auto; }
.bed { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: var(--space-3xs) var(--space-xs); min-height: 72px; padding: var(--space-md) 0 0; border-bottom: 14px solid var(--color-leaf); margin-inline: calc(var(--space-lg) * -1); padding-inline: var(--space-lg); }
.flower { --fc: var(--color-accent); position: relative; width: 16px; height: var(--h, 42px); }
.flower::before { content: ""; position: absolute; left: 7px; bottom: 0; width: 2px; height: 100%; background: var(--color-mint-deep); border-radius: 2px; }
.flower::after { content: ""; position: absolute; left: 0; top: 0; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle, var(--color-ink-2) 0 22%, var(--fc) 24%); }
.flower:nth-child(4n+2) { --fc: var(--color-accent-3); }
.flower:nth-child(4n+3) { --fc: var(--color-sugar); }
.flower:nth-child(4n) { --fc: var(--color-fringe); }
.sprout { width: 14px; height: 10px; border-radius: 0 80% 0 80%; background: var(--color-mint-deep); }

/* ---------- map: seed packets ---------- */
#chapters { width: 100%; display: grid; gap: var(--space-xl); }
.chapter h3 { font-size: var(--text-lg); margin-bottom: var(--space-sm); }
.packets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-sm); }
.packet { --edge: 5px; position: relative; border: 0; border-radius: var(--radius-stock); padding: var(--space-sm) var(--space-xs) var(--space-md); background: var(--color-card); box-shadow: inset 0 0 0 1px var(--color-rule), 0 var(--edge) 0 0 var(--color-edge); display: grid; justify-items: center; gap: var(--space-2xs); transition: translate var(--dur-micro) var(--ease-snap), box-shadow var(--dur-micro) var(--ease-snap); }
.packet:nth-child(odd) { rotate: -1.5deg; }
.packet:nth-child(even) { rotate: 1.2deg; }
.packet:hover:not(:disabled) { --edge: 7px; translate: 0 -2px; }
.packet:active:not(:disabled) { --edge: 1px; translate: 0 4px; }
.packet .num { font-size: var(--text-3xl); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.packet .name { font-size: var(--text-sm); color: var(--color-ink-2); line-height: 1.2; }
.packet.current { background: var(--color-accent); box-shadow: 0 var(--edge) 0 0 var(--color-accent-deep); }
.packet:disabled { background: var(--color-paper-3); box-shadow: none; color: var(--color-muted); cursor: not-allowed; }

.stars { display: flex; gap: var(--space-2xs); justify-content: center; }
.star { width: 14px; aspect-ratio: 1; background: var(--color-rule); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.star.on { background: var(--color-accent-deep); }
.packet.current .star.on { background: var(--color-ink); }
.stars--big .star { width: 54px; }
.stars--big .star.on { background: var(--color-accent); animation: star-in var(--dur-long) var(--ease-spring) backwards; }
.stars--big .star:nth-child(2) { animation-delay: 160ms; }
.stars--big .star:nth-child(3) { animation-delay: 320ms; }
@keyframes star-in { from { opacity: 0; translate: 0 -18px; rotate: -40deg; } }

/* ---------- game ---------- */
.game { gap: var(--space-md); padding-top: var(--space-md); user-select: none; -webkit-user-select: none; }
.hud { width: 100%; display: flex; flex-wrap: wrap; gap: var(--space-xs); justify-content: center; }
.chip { display: flex; align-items: baseline; gap: var(--space-2xs); padding: var(--space-2xs) var(--space-sm); border-radius: var(--radius-pill); background: var(--color-card); box-shadow: inset 0 0 0 1px var(--color-rule); font-size: var(--text-sm); color: var(--color-ink-2); }
.chip b { font-size: var(--text-lg); color: var(--color-ink); font-variant-numeric: tabular-nums; }
.chip.done { background: var(--color-mint); box-shadow: none; }
.chip.warn { background: var(--color-accent-3); box-shadow: none; }
.chip.warn, .chip.warn b { color: var(--color-ink); }

.board-wrap { background: var(--soil); padding: var(--space-xs); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.board { display: grid; grid-template-columns: repeat(8, var(--cell)); gap: var(--gap); border-radius: 18px; touch-action: none; }
.board.shake { animation: shake 260ms var(--ease-snap); }
@keyframes shake { 25% { translate: -5px 0; } 50% { translate: 4px 2px; } 75% { translate: -2px -1px; } }

.cell { position: relative; width: var(--cell); aspect-ratio: 1; border-radius: 9px; background: var(--plot); }
/* block face lives on ::before so clears can fade it while the plot stays */
.cell::before, .pc { border-radius: 9px; background: var(--bc); box-shadow: inset 0 3px 0 var(--shine), inset 0 -5px 0 color-mix(in oklab, var(--bc) 68%, var(--color-ink)); }
.cell::before { content: ""; position: absolute; inset: 0; opacity: 0; }
.cell.f::before { opacity: 1; }
.cell.pop::before { animation: drop var(--dur-short) var(--ease-snap); }
@keyframes drop { from { translate: 0 -10px; opacity: 0.3; } }

.b-pear { --bc: var(--color-accent); }
.b-blue { --bc: var(--color-accent-2); }
.b-coral { --bc: var(--color-accent-3); }
.b-mint { --bc: var(--color-mint); }
.b-sand { --bc: var(--color-sand); }
.b-sugar { --bc: var(--color-sugar); }
.rock { --bc: var(--color-kraft); }
.rock::before { background: radial-gradient(circle at 30% 35%, var(--shine) 0 8%, transparent 9%), radial-gradient(circle at 68% 64%, var(--soil) 0 7%, transparent 8%), var(--bc); }
.frost { --bc: var(--color-sugar); }
.frost::before { box-shadow: inset 0 0 0 3px var(--color-fringe), inset 0 -5px 0 color-mix(in oklab, var(--bc) 70%, var(--color-ink)); background: linear-gradient(135deg, transparent 44%, var(--color-fringe) 45% 50%, transparent 51%), var(--bc); }

.cell.seed::after { content: ""; position: absolute; z-index: 1; left: 31%; top: 31%; width: 38%; height: 38%; border-radius: 0 75% 0 75%; background: var(--color-mint-deep); pointer-events: none; }
.cell.seed.f::after { background: var(--color-fringe); box-shadow: 0 0 0 2px var(--color-mint-deep); }

.cell.ghost::before { opacity: 0.5; }
.cell.ghost.bomb-g::before { --bc: var(--color-accent-3); opacity: 0.35; }
.cell.hot::before { opacity: 1; box-shadow: 0 0 0 3px var(--color-accent), inset 0 -5px 0 color-mix(in oklab, var(--bc) 68%, var(--color-ink)); }
.cell.hot.seed::after { background: var(--color-accent-3); }

/* ---------- tray ---------- */
.tray { width: 100%; display: flex; justify-content: space-around; align-items: center; gap: var(--space-xs); min-height: calc(var(--cell) * 2.8); }
.slot { --m: calc(var(--cell) * 0.52); flex: 1 1 0; min-width: 0; min-height: calc(var(--cell) * 2.8); display: grid; place-items: center; border: 0; border-radius: var(--radius-stock); background: transparent; touch-action: none; transition: opacity var(--dur-short) var(--ease-snap), background-color var(--dur-micro) var(--ease-snap); }
.slot:hover { background: var(--color-paper-2); }
.slot.sel { background: var(--color-paper-3); box-shadow: inset 0 0 0 3px var(--color-accent-deep); }
.slot.dead { opacity: 0.32; }
.slot.lifted { opacity: 0.15; }
.slot.extra { flex: 0 1 18%; background: var(--color-hill-1); }
.slot:empty { pointer-events: none; }
.piece { display: grid; gap: var(--space-3xs); }
.drag .piece { gap: var(--gap); }
.pc { width: var(--m); height: var(--m); }
/* thinner shading at tray size so pieces read as blocks, not coins */
.slot .pc { border-radius: 5px; box-shadow: inset 0 1px 0 var(--shine), inset 0 -2px 0 color-mix(in oklab, var(--bc) 68%, var(--color-ink)); }
.pc.bomb { border-radius: 50%; background: radial-gradient(circle, var(--color-fringe) 0 18%, var(--bc) 20%); }
.drag { position: fixed; left: 0; top: 0; z-index: var(--z-toast); pointer-events: none; --m: var(--cell); will-change: translate; }

.tools { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; }

/* ---------- overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-md); background: var(--scrim); }
.overlay[hidden] { display: none; }
.modal { width: min(100%, 380px); background: var(--color-paper); border-radius: var(--radius-card); padding: var(--space-xl) var(--space-lg) var(--space-lg); box-shadow: var(--shadow-card); display: grid; gap: var(--space-md); text-align: center; animation: rise var(--dur-short) var(--ease-snap); }
@keyframes rise { from { opacity: 0; translate: 0 16px; } }
.modal h2 { font-size: var(--text-2xl); margin-inline: auto; }
.modal .goals { display: grid; gap: var(--space-2xs); color: var(--color-ink-2); }
.modal .big { font-size: var(--text-3xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.modal .row { display: grid; gap: var(--space-sm); }
.hint { background: var(--color-hill-1); border-radius: var(--radius-input); padding: var(--space-sm) var(--space-md); color: var(--color-ink-2); }
.ad-modal { background: var(--color-ink); color: var(--color-paper); }
.ad-label { font-weight: 600; }
.ad-count { font-size: calc(var(--text-3xl) * 1.6); font-weight: 600; font-variant-numeric: tabular-nums; }
.ad-modal .muted { color: var(--color-rule); }

/* ---------- effects ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-tooltip); overflow: clip; }
.fx > * { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.shard { border-radius: 9px; background: var(--bc); }
.petal { width: 10px; height: 14px; border-radius: 50% 50% 50% 0; background: var(--bc); }
.ftext { font-weight: 600; font-size: var(--text-xl); color: var(--color-ink); white-space: nowrap; text-shadow: 0 2px 0 var(--color-paper), 0 0 8px var(--color-paper); }
.ftext.big { font-size: var(--text-3xl); color: var(--color-accent-2); }
.toast { left: 50%; top: auto; bottom: var(--space-xl); translate: -50% 0; background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-pill); }

@media (max-width: 40rem) { .title { font-size: calc(var(--text-3xl) * 1.5); } .packet .num { font-size: var(--text-2xl); } }

/* landscape frames (CrazyGames embeds are about 16:9): board left, goals, tray and tools right */
@media (min-aspect-ratio: 5/4) and (max-height: 820px) {
  :root { --cell: clamp(26px, calc((100dvh - 168px) / 8), 58px); }
  .game { max-width: 1000px; min-height: 100dvh; display: grid; grid-template-columns: auto minmax(0, 320px); grid-template-areas: "bar bar" "board hud" "board tray" "board tools"; grid-template-rows: auto auto 1fr auto; justify-content: center; align-content: center; column-gap: var(--space-xl); row-gap: var(--space-sm); padding-block: var(--space-sm); }
  .game > .bar { grid-area: bar; }
  .hud { grid-area: hud; justify-content: flex-start; align-self: start; }
  .board-wrap { grid-area: board; align-self: center; }
  .tray { grid-area: tray; flex-direction: column; justify-content: center; min-height: 0; }
  .slot { --m: calc(var(--cell) * 0.5); flex: 0 0 auto; width: 100%; min-height: calc(var(--cell) * 1.7); }
  .slot.extra { flex: 0 0 auto; }
  .tools { grid-area: tools; justify-content: flex-start; }
}
