/* Pixel garden. Colours come from the chikūpod ramps (brown, cream, lavender, charcoal, lime, teal, coral). */
:root {
  --ink: #2B1F1B;
  --paper: #F1EFE8;
  --edge: #2B1F1B;
  --go: #A8F03C;
  --go-ink: #2B1F1B;
  --shade: #2B1F1B;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
body[data-phase="night"] {
  --ink: #ECE4F6;
  --paper: #25214E;
  --edge: #A99ED6;
  --shade: #14122E;
  --go: #B8A8E8;
  --go-ink: #1C1940;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1B272B; }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }

#garden { position: fixed; inset: 0; }
#scene {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- chips ---------- */
#count, #hint, #toast {
  position: fixed; left: 50%; transform: translateX(-50%); margin: 0;
  padding: 7px 12px; background: var(--paper); color: var(--ink);
  border: 3px solid var(--edge); box-shadow: 4px 4px 0 var(--shade);
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  pointer-events: none;
}
#count { top: max(14px, env(safe-area-inset-top)); opacity: 0; }
#count.on { opacity: 1; }
#hint { bottom: max(20px, env(safe-area-inset-bottom)); }
#hint.off { display: none; }
#toast { top: 66px; opacity: 0; transition: opacity .2s steps(2); z-index: 20; } /* above the picker */
#toast.on { opacity: 1; }

/* ---------- picker ---------- */
#picker {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px)); padding: 12px;
  background: var(--paper); border: 3px solid var(--edge); box-shadow: 6px 6px 0 var(--shade);
  z-index: 10;
}
#picker.top { bottom: auto; top: max(62px, env(safe-area-inset-top)); }
#picker[hidden] { display: none; }
.row { display: flex; justify-content: space-between; gap: 6px; }
.row + .row, #picker > * + * { margin-top: 10px; }

/* preview of the chosen flower, its name, colours */
.head { display: flex; gap: 10px; align-items: stretch; }
#preview {
  width: 58px; height: 70px; flex: none; image-rendering: pixelated; /* 13x16 at 4x inside the border */
  border: 3px solid var(--edge); background: rgba(140, 204, 92, 0.35); object-fit: contain;
}
.pick { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
#choice { margin: 0 0 6px; color: var(--ink); font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* all kinds at once: 5 per row, no scrolling */
#kinds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
#kinds button {
  aspect-ratio: 1; padding: 4px; cursor: pointer; min-height: 44px;
  background: rgba(140, 204, 92, 0.18); border: 3px solid transparent; /* a bit of meadow, so cream flowers show */
}
#kinds button:hover { border-color: color-mix(in srgb, var(--edge) 35%, transparent); }
#kinds button img { width: 100%; max-width: 44px; height: auto; aspect-ratio: 11 / 10; margin: auto; image-rendering: pixelated; display: block; }
#kinds button[aria-checked="true"] { border-color: var(--edge); background: rgba(140, 204, 92, 0.25); }
#colors button { flex: 1; max-width: 34px; aspect-ratio: 1; padding: 0; cursor: pointer; border: 3px solid var(--edge); }
#colors button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 5px var(--edge); }
.c0 { background: #C9BCD1; } .c1 { background: #E56B5D; } .c2 { background: #F2A59B; }
.c3 { background: #F1EFE8; } .c4 { background: #5fa8b8; } .c5 { background: #A8F03C; }
.actions button {
  flex: 1; height: 44px; cursor: pointer; font: inherit; font-size: 15px; font-weight: 700;
  border: 3px solid var(--edge); box-shadow: 3px 3px 0 var(--shade);
}
.actions button:active { transform: translate(3px, 3px); box-shadow: none; }
#cancel { background: var(--paper); color: var(--ink); }
#plant { background: var(--go); color: var(--go-ink); }
#plant:disabled { opacity: 0.5; }
button:focus-visible { outline: 3px solid #5fa8b8; outline-offset: 2px; }

html.og #hint, html.og #count, html.og #toast { display: none; }
