/* The page is a cross-section of the garden: live sky on top, earth below, and it flips
   between day and night with Squeektoshi's real wheel. Seed packets are the only paper. */
:root {
  --ink: #2b2135;
  --cream: #fff4dc;
  --paper: #f5e3c0;
  --leaf: #3fa34d;
  --leaf-light: #a6e36f;
  --gold: #f2b632;
  --orange: #f08a3a;
  --blue: #4f7fd8;
  --red: #ff9a8a;
  --m-zoom: var(--orange); --m-jog: var(--gold); --m-nap: var(--blue);
  --ui: 'Jersey 15', 'Courier New', monospace;
  --head: 'Pixelify Sans', 'Courier New', monospace;
  --num: 'VT323', 'Courier New', monospace;
  color-scheme: dark;
}
body[data-sky="night"] {
  --earth: #2e1e1f; --panel: #3d2a29; --line: #5b4240; --muted: #c9ad94;
  --furrow: #3f2a25; --furrow-dark: #33211f; --sky-ink: var(--cream); --sky-shade: #28366b;
}
body[data-sky="day"] {
  --earth: #6b4130; --panel: #54301f; --line: #8a5a3e; --muted: #e3c8a6;
  --furrow: #7a4a32; --furrow-dark: #683d29; --sky-ink: var(--ink); --sky-shade: #d4f1ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--earth); color: var(--cream); font: 400 21px/1.2 var(--ui); font-synthesis: none; overflow-x: hidden; }
img.spr, img.ico, .scene { image-rendering: pixelated; image-rendering: crisp-edges; }
h1, h2 { margin: 0; font-family: var(--head); }
h2 { font-size: 20px; font-weight: 600; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; }

/* sky */
.sky { position: relative; overflow: hidden; }
.scene { display: block; max-width: none; }
.sky-head {
  position: absolute; inset: 0 0 auto; max-width: 1180px; margin: 0 auto; padding: 22px 16px 0;
  color: var(--sky-ink); pointer-events: none;
}
h1 { font-size: clamp(30px, 4.6vw, 52px); font-weight: 700; line-height: 1; text-shadow: 3px 3px 0 var(--sky-shade); }
.lede { margin-top: 8px; max-width: 200px; font-size: 20px; line-height: 1.1; text-shadow: 2px 2px 0 var(--sky-shade); }
@media (min-width: 600px) { .lede { max-width: 34ch; font-size: 19px; } }

.wrap {
  max-width: 1180px; margin: 0 auto; display: grid; gap: 22px;
  padding-block: 8px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

button {
  font: 400 20px/1.1 var(--ui); color: var(--ink); background: var(--cream);
  border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); padding: 7px 12px; cursor: pointer; border-radius: 0;
}
button:hover { background: #fff; }
button:active { transform: translateY(3px); box-shadow: none; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button[aria-pressed="true"] { background: var(--gold); }
button:disabled { cursor: not-allowed; }

/* the wheel, right now */
.status { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) auto; gap: 16px 28px; align-items: center; }
@media (max-width: 900px) { .status { grid-template-columns: minmax(0, 1fr); } }
.now { display: grid; gap: 10px; justify-items: start; }
.pill { font: 400 19px/1 var(--ui); padding: 5px 8px; background: var(--panel); border: 2px solid var(--line); }
.pill.run { background: var(--orange); border-color: var(--ink); color: var(--ink); }
.pill.nap { background: var(--blue); border-color: var(--ink); }
.readout, .score { display: grid; gap: 8px 20px; margin: 0; }
.readout { grid-template-columns: repeat(4, auto); width: 100%; justify-content: space-between; }
.score { grid-template-columns: repeat(3, 1fr); }
dt { font-size: 18px; color: var(--muted); }
dd { margin: 0; font: 30px/1 var(--num); }
.strip { margin: 0; display: grid; gap: 4px; min-width: 0; }
.strip svg { width: 100%; height: 76px; display: block; }
.strip figcaption { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 18px; color: var(--muted); }
.strip figcaption span { display: inline-flex; align-items: center; gap: 4px; }
.ico { width: 16px; height: 16px; vertical-align: -2px; }
.ico.big { width: 32px; height: 32px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font: 22px/1.2 var(--num); padding: 0 6px; }
.chip.nap { background: var(--blue); } .chip.jog { background: var(--gold); color: var(--ink); } .chip.zoom { background: var(--orange); color: var(--ink); }

.you { display: grid; gap: 8px; min-width: 190px; }
.purse { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; font-size: 19px; }
.purse b { font: 28px/1 var(--num); }
.pips { display: inline-flex; align-items: center; gap: 4px; }
.pips b { color: var(--gold); }
.xp { display: grid; gap: 3px; }
.xpbar { display: block; height: 8px; background: var(--ink); }
.xpbar i { display: block; height: 100%; background: var(--leaf-light); }
.xp small { font-size: 18px; color: var(--muted); }
.modes { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.guidelink { align-self: center; padding: 0 4px; color: var(--cream); }
.bed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; }

/* the bed and the shop sit side by side: pick a packet, tap a plot */
.main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 1000px) { .main { grid-template-columns: minmax(0, 1fr); } }
.bed, .shop, .shop section { display: grid; gap: 10px; min-width: 0; }
.shop { gap: 20px; }
.hint { min-height: 1.35em; color: var(--muted); }
@media (max-width: 760px) { .hint { min-height: 4.05em; } }
.hint.warn { color: var(--ink); background: var(--gold); padding: 2px 8px; min-height: 0; justify-self: start; }
.rules, .note { font-size: 19px; color: var(--muted); max-width: 70ch; }

.plots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.plot {
  position: relative; display: grid; grid-template-rows: 1fr auto; justify-items: stretch; text-align: center;
  height: 150px; padding: 0; border: 0; box-shadow: none; color: var(--cream); font: inherit;
  background: repeating-linear-gradient(0deg, var(--furrow) 0 8px, var(--furrow-dark) 8px 16px);
}
.plot:hover { background: repeating-linear-gradient(0deg, var(--furrow) 0 8px, var(--furrow-dark) 8px 16px); filter: brightness(1.12); }
.plot:active { transform: none; box-shadow: none; }
.plot img.spr { width: 80px; height: 80px; justify-self: center; align-self: end; }
.plate { display: grid; gap: 2px; justify-items: center; padding: 5px 6px 6px; background: var(--panel); }
.plot .pname { font-size: 19px; font-weight: 600; line-height: 1.15; }
.plot .pstat { font-size: 18px; line-height: 1.15; color: var(--muted); }
.plot .pstat b { color: var(--gold); font-weight: 600; }
.plot .gbar { width: 80%; height: 6px; margin-top: 2px; background: var(--ink); }
.plot .gbar i { display: block; height: 100%; background: var(--leaf-light); }
.plots.planting .plot.empty { outline: 2px dashed var(--gold); outline-offset: -4px; }
.plot img.ghost { opacity: .32; }
.plot.empty:hover img.ghost, .plot.empty:focus-visible img.ghost { opacity: .8; }
.plot.ripe { outline: 3px solid var(--gold); outline-offset: -3px; }
.plot.ripe .pstat { color: var(--gold); }
.plot.wilted img.spr, .plot.rotten img.spr { opacity: .8; }
.plot.locked { display: grid; grid-template-rows: none; place-content: center; justify-items: center; background: none; border: 2px dashed var(--line); }
.plot img.dome { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; image-rendering: pixelated; }
.plot img.sparkle { position: absolute; top: 12px; left: 16%; width: 21px; height: 21px; image-rendering: pixelated; animation: blink .6s steps(1) infinite; }
@keyframes blink { 50% { visibility: hidden; } }

/* seed packets */
.seeds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seed {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 8px; align-items: center; text-align: left;
  padding: 0 8px 7px; background: var(--paper); color: var(--ink);
}
.seed:hover { background: var(--cream); }
.seed .band { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; margin: 0 -8px 6px; padding: 2px 8px; font-size: 17px; font-weight: 600; line-height: 1.2; }
.band-nap { background: var(--blue); color: var(--cream); }
.band-jog { background: var(--gold); }
.band-zoom { background: var(--orange); }
.band-leaf { background: var(--leaf); color: var(--cream); }
.band-gold { background: var(--ink); color: var(--gold); }
.seed img.spr { grid-row: 2 / 4; width: 44px; height: 44px; }
.seed b { font-size: 19px; font-weight: 600; line-height: 1.1; }
.seed small { font-size: 17px; line-height: 1.15; color: #6b4a33; }
.seed[aria-pressed="true"] { background: #fff; outline: 3px solid var(--gold); outline-offset: 1px; transform: translateY(-2px); }
.seed.locked { opacity: .62; }
.seed.locked img.spr { filter: brightness(0) opacity(.3); }
@media (max-width: 760px) {
  .seeds { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 168px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; }
  .seed { scroll-snap-align: start; }
}

.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; align-items: center; text-align: left; padding: 6px 8px; background: var(--panel); color: var(--cream); border-color: var(--line); box-shadow: none; }
.tool:hover { background: var(--line); }
.tool[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.tool[aria-pressed="true"] small { color: var(--ink); }
.tool:active { transform: none; }
.tool b { display: block; font-size: 19px; font-weight: 600; line-height: 1.1; }
.tool small { display: block; font-size: 17px; line-height: 1.15; margin-top: 2px; color: var(--muted); }
.buy { grid-column: 1 / -1; background: var(--gold); }
.buy:hover { background: var(--cream); }

/* the record */
.record summary { font: 600 20px/1.2 var(--head); cursor: pointer; }
.record summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.record .lower { margin-top: 12px; }
.lower { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 16px; align-items: stretch; }
@media (max-width: 1000px) { .lower { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--panel); padding: 12px 14px 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.walletrow { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.walletbtn { background: var(--gold); }
.walletbtn:hover { background: var(--cream); }
.savebar { display: flex; flex-wrap: wrap; gap: 6px; }
.quest { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.quest b { font-weight: 400; }
.quest span { background: var(--gold); color: var(--ink); padding: 0 6px; font-size: 19px; }
.quest.done span { background: var(--leaf-light); }

.herb { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
@media (max-width: 560px) { .herb { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.herb li { display: grid; justify-items: center; background: var(--paper); color: var(--ink); padding: 3px 2px 0; font: 18px/1 var(--num); }
.herb li img.spr { width: 100%; max-width: 48px; height: auto; }
.herb li.missing { background: var(--earth); color: var(--muted); }
.herb li.missing img.spr { filter: brightness(0) invert(1) opacity(.16); }
.ach { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.ach li { padding: 4px 8px 5px; display: grid; color: var(--muted); background: var(--earth); }
.ach li b { font-size: 18px; font-weight: 600; }
.ach li small { font-size: 17px; line-height: 1.15; }
.ach li.got { background: var(--gold); color: var(--ink); }

.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; align-content: start; max-height: 330px; overflow-y: auto; font-size: 19px; line-height: 1.2; }
.log li { display: grid; grid-template-columns: 44px 1fr; gap: 4px; }
.log time { font: 17px/1.1 var(--num); color: var(--muted); }
.log .good span { color: var(--leaf-light); }
.log .bad span { color: var(--red); }

.foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 19px; color: var(--muted); }
.foot a { color: var(--cream); }
.float { position: absolute; transform: translateX(-50%); font: 700 22px var(--head); color: var(--gold); text-shadow: 2px 2px 0 var(--ink); pointer-events: none; animation: rise 1.1s steps(6) forwards; }
@keyframes rise { from { translate: 0 0; } to { translate: 0 -48px; opacity: 0; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--gold); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  padding: 10px 16px; font-weight: 600; max-width: calc(100% - 32px);
}
@media (prefers-reduced-motion: reduce) { .plot img.sparkle, .float { animation: none; } }

/* guide page */
.guide-page .wrap { max-width: 900px; padding-top: 28px; }
.guide-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; }
.guide-page h1 { color: var(--cream); text-shadow: 3px 3px 0 var(--ink); }
.steps { margin: 0; padding-left: 26px; display: grid; gap: 8px; max-width: 68ch; }
.steps b { font-weight: 400; color: var(--gold); }
.seedtable { width: 100%; border-collapse: collapse; }
.seedtable th { text-align: left; font-weight: 400; color: var(--muted); padding: 0 12px 6px 0; }
.seedtable td { padding: 4px 12px 4px 0; border-top: 2px solid var(--line); vertical-align: middle; }
.seedtable td:first-child { display: flex; align-items: center; gap: 8px; }
.seedtable td:last-child, .seedtable th:last-child { text-align: right; padding-right: 0; font-family: var(--num); }
.seedtable img.spr { width: 32px; height: 32px; }
@media (max-width: 640px) {
  .seedtable thead { display: none; }
  .seedtable, .seedtable tbody, .seedtable tr, .seedtable td { display: block; }
  .seedtable tr { border-top: 2px solid var(--line); padding: 6px 0; }
  .seedtable td, .seedtable td:last-child { border: 0; padding: 0; text-align: left; }
}

/* phones: get the plots on screen sooner */
@media (max-width: 760px) {
  h1 { font-size: 26px; }
  .sky-head { padding-top: 12px; }
  .lede, .strip figcaption, .xp small { display: none; }
  .wrap { gap: 14px; }
  .status { gap: 8px; }
  .now, .you { gap: 6px; }
  .strip svg { height: 48px; }
  .hint { min-height: 2.4em; }
}

/* leaderboard page */
.board-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.board { width: 100%; border-collapse: collapse; }
.board th { text-align: left; font-weight: 400; color: var(--muted); padding: 0 12px 6px 0; }
.board td { padding: 5px 12px 5px 0; border-top: 2px solid var(--line); }
.board td:first-child, .board td:last-child, .board th:last-child { font-family: var(--num); font-size: 24px; }
.board td:last-child, .board th:last-child { text-align: right; padding-right: 0; }
.board tr.me td { color: var(--gold); }
