:root {
  --cream: #fffaea;
  --paper: #fffdf5;
  --line: #e7dfc4;
  --ink: #2b3a2c;
  --muted: #64735a;
  --green: #2f6b45;
  --green-dark: #24543a;
  --gold: #f4c64e;
  --gold-dark: #c99a24;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd8f5; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; color: var(--ink); }
button { font: inherit; cursor: pointer; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.panel {
  position: fixed;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgb(40 60 30 / .18);
}

.title {
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
}
.title h1 { margin: 0; font: 700 24px Georgia, serif; color: var(--green-dark); }
.leaf { font-size: 22px; }
.coins {
  margin-left: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 7px;
  font: 700 20px Georgia, serif;
  font-variant-numeric: tabular-nums;
}
.sound {
  margin-left: 4px;
  border: 0;
  background: none;
  padding: 2px 4px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: .75;
}
.sound:hover { opacity: 1; }
.coin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe390, #d79b1d);
  box-shadow: 0 0 0 1.5px #a8740f;
}

.side {
  top: 16px;
  right: 16px;
  width: 290px;
  max-height: calc(100% - 32px);
  overflow: auto;
  padding: 12px 14px 14px;
}
/* The minimize button sits in the panel's top corner and stays there as the cards scroll. Minimized, the panel
   rolls up into a small "Menu" box with a + to open it again. */
.side-bar {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px -2px 0 8px;
}
.side-label { display: none; font: 700 15px Georgia, serif; color: var(--green-dark); }
.minimize {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  color: var(--green-dark);
  font: 700 18px/1 Georgia, serif;
  cursor: pointer;
}
.minimize:hover { background: #f1ead2; }
.side.rolled { width: auto; padding: 8px 8px 8px 14px; overflow: hidden; }
.side.rolled > :not(.side-bar) { display: none !important; }
.side.rolled .side-bar { float: none; position: static; margin: 0; }
.side.rolled .side-label { display: inline; }
.side h2 { margin: 6px 2px 8px; font: 700 16px Georgia, serif; color: var(--green-dark); }
.side h2 + .cards { margin-bottom: 10px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.card .name { font-weight: 650; font-size: 14px; }
.card .what { grid-column: 1; font-size: 12px; color: var(--muted); }
.card .bars { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 6px; align-items: center; margin-top: 4px; font-size: 11px; color: var(--muted); }
.card[hidden], .card .bars[hidden], .cards[hidden], .side h2[hidden] { display: none; }
.bar { height: 5px; border-radius: 3px; background: #ebe6d2; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.bar.food span { background: #e0943a; }
.buy {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 92px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f5f1e2;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
}
.buy.ready { background: var(--gold); border-color: var(--gold-dark); color: var(--ink); }
.buy.ready:hover { filter: brightness(1.05); }
.buy:disabled { cursor: default; }
.card.done .buy { display: none; }
.buy[hidden], .crop-pick[hidden] { display: none; }
.crop-pick {
  grid-column: 2;
  grid-row: 1 / span 2;
  height: 36px;
  max-width: 140px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f5f1e2;
  color: var(--ink);
  font: 600 13px system-ui, sans-serif;
}

.hint {
  left: 16px;
  bottom: 16px;
  padding: 10px 16px;
  font-size: 14px;
  max-width: min(560px, calc(100% - 340px));
}
.tip {
  position: fixed;
  transform: translate(-50%, -130%);
  background: var(--green-dark);
  color: var(--cream);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}
.nudge {
  position: fixed;
  transform: translate(-50%, calc(-100% - 20px));
  pointer-events: none;
  transition: opacity .4s;
}
.nudge.gone { opacity: 0; }
.nudge .bubble {
  /* A little wooden sign on a stake, like the fields' price signs. */
  position: relative;
  padding: 6px 15px 7px;
  background: #f6e7c1;
  border: 3px solid #9b6331;
  border-radius: 7px;
  box-shadow: 0 4px 10px rgb(60 35 10 / .3), inset 0 0 0 1px #e8d29e;
  font: 700 14px Georgia, serif;
  color: #6b4423;
  white-space: nowrap;
  animation: nudge-bob 1.6s ease-in-out infinite;
}
.nudge .bubble::before {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  background:
    radial-gradient(circle, #7a4a26 1.6px, transparent 2px) left top / 8px 8px no-repeat,
    radial-gradient(circle, #7a4a26 1.6px, transparent 2px) right top / 8px 8px no-repeat;
}
.nudge .bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  width: 8px;
  height: 18px;
  background: linear-gradient(90deg, #7a4a26, #a8723f 45%, #7a4a26);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 3px rgb(60 35 10 / .3);
  transform: translateX(-50%);
}
#welcome .bubble { white-space: normal; width: max-content; max-width: min(300px, 80vw); text-align: center; }
@keyframes nudge-bob { 50% { transform: translateY(-5px); } }
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--cream);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 6px 16px rgb(0 0 0 / .18);
}
.pop {
  position: fixed;
  transform: translate(-50%, -50%);
  font: 700 18px Georgia, serif;
  color: #8a5a00;
  text-shadow: 0 1px 0 #fff6cf, 0 0 6px #fff6cf;
  pointer-events: none;
  animation: rise 1.3s ease-out forwards;
}
@keyframes rise { to { transform: translate(-50%, -260%); opacity: 0; } }
.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 18px Georgia, serif;
  color: var(--green-dark);
  background: #bfe6f7;
}
.restart {
  position: fixed;
  right: 16px;
  bottom: 16px;
  border: 0;
  background: none;
  color: var(--green-dark);
  font-size: 12px;
  text-decoration: underline;
  opacity: .7;
}
.season-wheel {
  position: fixed;
  right: 16px;
  bottom: 40px;
  width: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 4;
}
.season-wheel[hidden] { display: none; }
.season-wheel svg { width: 132px; height: 137px; overflow: visible; filter: drop-shadow(0 5px 10px rgb(40 60 30 / .22)); }
.season-wheel .disc, .season-wheel .icon {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.1s cubic-bezier(.45, .05, .25, 1);
}
.season-wheel .slice { cursor: pointer; outline: none; }
.season-wheel .slice path { transition: filter .25s ease; filter: saturate(.55) brightness(1.04); }
.season-wheel .slice.on path, .season-wheel .slice:hover path { filter: none; }
.season-wheel .slice.on { cursor: default; }
.season-wheel .slice:focus-visible path { stroke: var(--gold-dark); stroke-width: 3; }
.season-name {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--green-dark);
  font: 700 12px Georgia, serif;
}
/* A soft wash of light that covers the farm while one season turns into the next. */
.season-fade {
  position: fixed;
  inset: 0;
  background: #fffaf0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .7s ease;
}
.season-fade.on { opacity: 1; }
:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }

/* Tall or narrow windows: the side panel becomes a sheet along the bottom and the hint sits under the title,
   so the farm gets the full width above. */
@media (max-aspect-ratio: 1/1), (max-width: 900px) {
  .side { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; max-height: 42%; }
  .side.rolled { left: auto; bottom: 44px; }
  .hint { top: 84px; bottom: auto; max-width: calc(100% - 32px); }
  /* The wheel sits above the rolled-up menu, and steps aside while the menu sheet is open. */
  .season-wheel { bottom: 96px; width: 104px; }
  .season-wheel svg { width: 104px; height: 108px; }
  .side:not(.rolled) ~ .season-wheel { display: none; }
}

/* Travel between farms you own: small floating pills under the menu. */
.side.leaves-room { max-height: calc(100% - 84px); }
.travel { position: fixed; right: 16px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pill {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--green-dark);
  font: 700 14px Georgia, serif;
  box-shadow: 0 6px 20px rgb(40 60 30 / .18);
  cursor: pointer;
}
.pill:hover { background: #f1ead2; }
.pill[hidden] { display: none; }
