* { box-sizing: border-box; margin: 0; padding: 0; }

/* Twemoji images render identically on every OS instead of native emoji */
img.emoji {
  height: 1em;
  width: 1em;
  margin: 0 0.05em;
  vertical-align: -0.15em;
  display: inline-block;
}
.slot-icon img.emoji, .chip-icon img.emoji, .shop-icon img.emoji { margin: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #3a2f28;
  background: #bfe3ff;
}

#game { position: fixed; inset: 0; }

/* The 3D canvas fills the whole screen */
#scene-wrap { position: absolute; inset: 0; }
#scene-wrap canvas { display: block; width: 100%; height: 100%; }

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;   /* above the title (60) and splash (300) so ONLY the loader shows while the world builds */
  background: linear-gradient(160deg, #bfe3a0, #86c06b 55%, #6aa9d6);
}
.load-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
/* the spinner + sprout animate via transform/opacity, which run on the compositor thread —
   so they KEEP moving even while the main JS thread is busy building the world. */
.load-spinner {
  width: 58px; height: 58px; border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.45); border-top-color: #4a7c3b;
  animation: loadspin 0.9s linear infinite;
}
@keyframes loadspin { to { transform: rotate(360deg); } }
.load-sprout {
  position: absolute; top: 13px; left: 0; right: 0; text-align: center; font-size: 26px;
  animation: loadbob 0.9s ease-in-out infinite;
}
@keyframes loadbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.load-text {
  font: 800 1.2rem Inter, system-ui, sans-serif; letter-spacing: 0.3px; color: #2f4a1e;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4); animation: loadpulse 1.5s ease-in-out infinite;
}
@keyframes loadpulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---------------------------------------------------------------- HUD ---- */
#hud {
  position: absolute;
  top: 18px;
  left: 18px;
  width: min(330px, calc(100% - 36px));
  display: grid;
  gap: 12px;
  pointer-events: none; /* clicks pass through to the world… */
}

#hud .panel { pointer-events: auto; } /* …except on the panels themselves */

.panel {
  border-radius: 20px;
  padding: 16px 18px;
  background: rgba(255, 251, 244, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(156, 113, 78, 0.18);
  box-shadow: 0 12px 30px rgba(60, 40, 15, 0.18);
}

.title-panel h1 {
  font-size: 1.5rem;
  line-height: 1.15;
  color: #5a3d26;
}

.title-panel p {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #7a6453;
}

.panel h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9a8068;
  margin-bottom: 10px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.stats p {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a3b30;
}

.stats .ic { font-size: 1.05rem; }

/* Reusable gold coin (reliably gold, unlike the 🪙 emoji) */
.coin {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff0b0, #f4c430 55%, #c8941f);
  border: 1px solid #d9a52a;
  box-shadow: inset 0 -2px 3px rgba(120, 80, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
  vertical-align: -0.15em;
}

.coin-sm { width: 0.85em; height: 0.85em; vertical-align: -0.08em; }

/* ---------------------------------------------------------- Bag panel ---- */
#clock {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 215px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: #5a4636;
}
#clock #clock-icon { font-size: 1.5rem; line-height: 1; }
#clock #clock-time { font-size: 1.1rem; letter-spacing: 0.5px; }

#bag {
  position: absolute;
  top: 88px;          /* sits below the day/night clock */
  right: 18px;
  width: 215px;
}

/* While the corner minimap is showing it owns the top-right corner, so slide the
   clock + status card down below it. Removed (back to top) when the minimap hides
   off-surface, so there's no empty gap. Toggled via body.mini-on in renderMiniMap(). */
body.mini-on #clock { top: 178px; }
body.mini-on #bag   { top: 248px; }

#bag .stats { grid-template-columns: 1fr; gap: 8px; }
#bag .bag-hint { opacity: 0.75; font-size: 0.85rem; }
#bag .bag-hint b { color: #6a542a; }

.buy-btn {
  margin-top: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 2px solid #cdae62;
  border-radius: 12px;
  background: #fff6df;
  color: #6a542a;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.buy-btn:hover { background: #ffefc4; transform: translateY(-1px); }

/* ----------------------------------------------------- Growth meter ------ */
#cropmeter {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 30px 12px 18px;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(156, 113, 78, 0.2);
  box-shadow: 0 10px 28px rgba(60, 40, 15, 0.22);
  cursor: pointer;
  transition: opacity 0.25s ease;
}
#cropmeter:hover { background: rgba(255, 255, 255, 0.98); }
.cm-close {
  position: absolute;
  top: 8px;
  right: 11px;
  font-size: 0.85rem;
  color: #9a8068;
  font-weight: 800;
}
#cropmeter.hidden { display: none; }
.cm-icon { font-size: 2rem; line-height: 1; }
.cm-body { min-width: 180px; }
.cm-name { font-weight: 800; color: #4a3b30; margin-bottom: 6px; }
.cm-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(120, 90, 60, 0.18);
  overflow: hidden;
}
.cm-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd24a, #74c161);
  transition: width 0.3s ease;
}
.cm-status { margin-top: 5px; font-size: 0.82rem; color: #6f594c; font-weight: 600; }

/* ------------------------------------------------------- Seed picker ----- */
#seedbar {
  position: absolute;
  bottom: 124px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 92vw;
  padding: 9px 11px;
  border-radius: 16px;
  background: rgba(255, 251, 244, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(156, 113, 78, 0.18);
  box-shadow: 0 10px 26px rgba(60, 40, 15, 0.24);
}
#seedbar.hidden { display: none; }

/* Chat window — lower-left: scrolling message log above an always-visible input */
#chatwindow {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: min(320px, 46vw);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 40;
}
#chatlog {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 196px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(28, 20, 12, 0.44);
  backdrop-filter: blur(6px);
  font: 500 13px Inter, system-ui, sans-serif;
  color: #fdf6ea;
  scrollbar-width: thin;
}
#chatlog:empty { display: none; }
.chat-line { line-height: 1.32; word-wrap: break-word; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); }
.chat-who { font-weight: 700; color: #ffd98a; }
.chat-line.mine .chat-who { color: #9fe0a0; }
#chat-input {
  border: 1px solid rgba(156, 113, 78, 0.3);
  background: rgba(255, 251, 244, 0.96);
  border-radius: 18px;
  padding: 8px 14px;
  font: 600 14px Inter, system-ui, sans-serif;
  color: #3a2a1c;
}
#chat-input::placeholder { color: rgba(90, 61, 38, 0.55); font-weight: 500; }
#chat-input:focus { outline: none; border-color: #e7b94a; background: #fff; }

/* Land map */
#landmap.hidden { display: none; }
.lm-hint { text-align: center; color: #6a5238; font-size: 13px; margin: 2px 0 10px; }
#landmap-grid {
  display: grid;
  gap: 2px;
  justify-content: center;
  margin: 0 auto 8px;
  max-width: 100%;
  max-height: 50vh;
  overflow: auto;
  padding: 4px;
  background: rgba(120, 110, 98, 0.1);
  border-radius: 10px;
  touch-action: none;                       /* let drag-select work without scrolling */
}
.lm-cell {
  width: 24px; height: 24px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font: 700 10px Inter, system-ui, sans-serif;
  color: #2a1c10;
  box-sizing: border-box;
  background: rgba(120, 110, 98, 0.22);     /* default = locked */
  user-select: none;
}
.lm-cell.lm-buy { transition: background 0.1s; }
.lm-cell.lm-dragsel { background: #84b8ec !important; box-shadow: inset 0 0 0 2px #2f6db0; color: #fff; }
.lm-info {
  text-align: center; font: 700 13px Inter, system-ui, sans-serif; color: #5a3d26;
  background: rgba(120, 90, 60, 0.1); border-radius: 10px; padding: 7px 10px; margin: 0 auto 10px;
  min-height: 1.3em;
}
.lm-cell.lm-owned { background: #7bbf6a; }
.lm-cell.lm-buy { background: #f4e7c6; border: 1px solid #d9a84a; cursor: pointer; }
.lm-cell.lm-buy:hover { outline: 2px solid #b8801f; outline-offset: -2px; }
.lm-cell.lm-sel { background: #6fa8e0; border: 1px solid #2f6db0; color: #fff; cursor: pointer; }
.lm-cell.lm-sel:hover { background: #84b8ec; }
.lm-cell.lm-here { outline: 2px solid #e74c3c; outline-offset: -2px; }
.lm-cell.lm-town { background: #cdbfa6; opacity: 0.7; font-size: 11px; cursor: default; }
.lm-clear.active { background: #d9a441; color: #fff; }
#landmap-foot { display: flex; gap: 10px; justify-content: center; align-items: center; margin-bottom: 10px; }
#landmap-foot .buy-btn { margin-top: 0; }
.buy-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.lm-clear { background: rgba(120, 90, 60, 0.16); color: #6a5238; border: none; border-radius: 14px; padding: 9px 16px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; }
.lm-clear:hover { background: rgba(120, 90, 60, 0.28); }
#landmap-workers { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.lm-workers-h { font: 700 13px Inter, system-ui, sans-serif; color: #5a3d26; }
.lm-section { margin-bottom: 6px; }
.lm-section-h {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 8px;
  background: rgba(120, 90, 60, 0.12); border: none; border-radius: 10px; padding: 9px 12px;
  font: 700 13px Inter, system-ui, sans-serif; color: #5a3d26; cursor: pointer;
}
.lm-section-h:hover { background: rgba(120, 90, 60, 0.22); }
.lm-caret { font-size: 11px; width: 0.9em; color: #8a6a3a; }
.lm-section-body { display: flex; flex-direction: column; gap: 5px; margin-top: 5px; padding-left: 4px; }
.lm-worker { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 600 13px Inter, system-ui, sans-serif; color: #6a5238; background: rgba(120, 90, 60, 0.08); border-radius: 10px; padding: 6px 10px; }
.lm-fire { background: #d9534f; color: #fff; border: none; border-radius: 12px; padding: 5px 12px; font: 700 12px Inter, system-ui, sans-serif; cursor: pointer; flex: 0 0 auto; }
.lm-fire:hover { background: #c9302c; }
.lm-name-input { flex: 1 1 auto; min-width: 0; background: rgba(255, 255, 255, 0.75); border: 1px solid rgba(120, 90, 60, 0.3); border-radius: 8px; padding: 5px 9px; font: 600 13px Inter, system-ui, sans-serif; color: #5a3d26; }
.lm-name-input:focus { outline: none; border-color: #c08a3e; background: #fff; }
.lm-name-input::placeholder { color: #a9926f; font-weight: 600; }
.lm-nametoggle { display: flex; align-items: center; gap: 7px; font: 600 13px Inter, system-ui, sans-serif; color: #5a3d26; margin-bottom: 9px; cursor: pointer; user-select: none; }
.lm-nametoggle input { width: 15px; height: 15px; accent-color: #6aa84f; cursor: pointer; }
#landmap-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font: 600 12px Inter, system-ui, sans-serif; color: #6a5238; margin-bottom: 12px; }
.lm-key { display: flex; align-items: center; gap: 6px; }
.lm-key i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.lm-key i.lm-owned { background: #7bbf6a; }
.lm-key i.lm-buy { background: #f4e7c6; border: 1px solid #d9a84a; }
.lm-key i.lm-locked { background: rgba(120, 110, 98, 0.5); }
.lm-key i.lm-sel { background: #6fa8e0; border: 1px solid #2f6db0; }
.lm-key i.lm-heredot { background: #fff; outline: 2px solid #e74c3c; outline-offset: -2px; }
/* Land Management: a wider panel + bigger cells/buttons so the (now larger) prices read clearly */
#landmap .shop-card { width: min(620px, calc(100% - 28px)); }
#wardrobe .shop-card { width: min(540px, calc(100% - 28px)); }
#landmap .lm-cell { width: 28px; height: 28px; font-size: 10px; }
#landmap-grid { gap: 3px; }
#landmap-foot { gap: 12px; }
#landmap-foot .buy-btn { padding: 13px 22px; font-size: 15px; }
#landmap-foot .lm-clear { padding: 12px 18px; font-size: 14.5px; }
.sp-tabs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.sp-tab {
  padding: 5px 12px; border-radius: 10px; border: 1px solid rgba(156, 113, 78, 0.25);
  background: #f0e6d6; color: #6a542a; font-weight: 800; font-size: 0.85rem; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sp-tab:hover { background: #e7dac6; }
.sp-tab.active { background: #f4b942; color: #4a3210; border-color: #d79a2a; }

/* Appearance: pin the tab bar to the top so the Outfit tab (and friends) can keep
   growing more dress-up options without the tabs scrolling out of reach. The negative
   side margins bleed over the card's padding so scrolling content never peeks past it. */
#wardrobe-body .sp-tabs:not(.mk-sub) {
  position: sticky;
  top: -1px;
  z-index: 3;
  background: rgba(255, 251, 244, 0.98);
  margin: 0 -22px 8px;
  padding: 6px 22px 8px;
}
.sp-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 470px; }

.seed-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 64px;
  padding: 7px 4px;
  border: 2px solid transparent;
  border-radius: 11px;
  background: #f0e6d6;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}

.seed-chip:hover { transform: translateY(-2px); background: #e7dac6; }

.seed-chip.active {
  background: #fff6df;
  border-color: #e7b94a;
  box-shadow: 0 0 0 2px rgba(231, 185, 74, 0.3);
}

.seed-chip .chip-icon { font-size: 1.5rem; line-height: 1; }
.seed-chip .chip-name { font-size: 0.64rem; font-weight: 700; color: #5a4636; text-align: center; line-height: 1.05; }
.seed-chip .chip-count { font-size: 0.78rem; font-weight: 800; color: #6a542a; }
.seed-chip .chip-season { position: absolute; top: 3px; right: 4px; font-size: 0.78rem; line-height: 1; }
.seed-chip.locked { opacity: 0.5; filter: saturate(0.5); }
.seed-chip.locked:hover { transform: none; background: #f0e6d6; }
.seed-chip.locked .chip-count { color: #9a8068; }

/* ----------------------------------------------------- Appearance -------- */
.hud-btn {
  pointer-events: auto;
  align-self: start;
  padding: 9px 16px;
  border: 1px solid rgba(156, 113, 78, 0.25);
  border-radius: 14px;
  background: rgba(255, 251, 244, 0.92);
  backdrop-filter: blur(8px);
  color: #5a4636;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(60, 40, 15, 0.16);
  transition: transform 0.12s ease, background 0.15s ease;
}
.hud-btn:hover { transform: translateY(-1px); background: #fff; }

.ward-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(156, 113, 78, 0.16);
}
.ward-label { width: 56px; font-weight: 700; color: #6a544339; color: #5a4636; font-size: 0.9rem; }
.ward-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.ward-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.ward-swatch:hover { transform: scale(1.12); }
.ward-swatch.sel { border-color: #e7b94a; box-shadow: 0 0 0 3px rgba(231, 185, 74, 0.4); }
.ward-opt {
  padding: 7px 13px;
  border: 2px solid transparent;
  border-radius: 11px;
  background: #f0e6d6;
  color: #5a4636;
  font-weight: 700;
  cursor: pointer;
}
.ward-opt.sel { background: #fff6df; border-color: #e7b94a; }
.ward-opt.danger { background: #fbe6e0; border-color: #c0533a; color: #9a3a26; font-weight: 700; }
.ward-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid rgba(156, 113, 78, 0.3);
  border-radius: 11px;
  background: #fffdf8;
  color: #4a3b30;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
}
.ward-input:focus { outline: none; border-color: #e7b94a; }

/* --------------------------------------- Inventory (slotted Items tab) --- */
.inv-slots {
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
}
.inv-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(156, 113, 78, 0.28);
  border-radius: 11px;
  background: rgba(120, 92, 60, 0.08);
  box-shadow: inset 0 1px 3px rgba(60, 40, 15, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.inv-slot.filled {
  background: rgba(255, 251, 244, 0.95);
  cursor: grab;
  touch-action: none;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.inv-slot.filled:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(60, 40, 15, 0.18); }
.inv-slot.filled:active { cursor: grabbing; transform: scale(0.96); }
/* placeables glow gold so you know they can be dragged out onto the farm */
.inv-slot.placeable { border-color: rgba(231, 185, 74, 0.7); background: #fff6df; }
.inv-icon { font-size: 1.55rem; line-height: 1; pointer-events: none; }
.inv-count {
  position: absolute;
  bottom: 1px; right: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #4a3416;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.inv-structure {
  display: block; width: 100%;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid rgba(231, 185, 74, 0.6);
  border-radius: 11px;
  background: #fff6df;
  color: #5a4636;
  font-weight: 700;
  cursor: pointer;
}
.inv-structure small { font-weight: 600; color: #9c714e; }
.inv-foot {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 4px;
  border-top: 1px solid rgba(156, 113, 78, 0.16);
  font-size: 0.95rem;
  color: #5a4636;
}
.inv-foot b { color: #6a542a; }
.inv-hotbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(156, 113, 78, 0.16);
}
.inv-tool {
  position: relative;
  width: 46px; height: 46px;
  border: 2px solid rgba(156, 113, 78, 0.25);
  border-radius: 11px;
  background: rgba(255, 251, 244, 0.95);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.inv-tool.selected { border-color: #e7b94a; background: #fff6df; box-shadow: 0 0 0 3px rgba(231, 185, 74, 0.35); }
.inv-tool-icon { font-size: 1.35rem; line-height: 1; }
.inv-tool-key {
  position: absolute; top: 1px; left: 4px;
  font-size: 0.6rem; font-weight: 800; color: #9c714e;
}
/* the icon that follows the cursor while dragging an item */
.inv-drag-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  pointer-events: none;
  z-index: 200;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* ------------------------------------------------- Shop + Stand overlays - */
#shop, #stand, #wardrobe, #settings, #admin, #help, #landmap, #navmap, #adopt, #craft, #quest, #achievements, #demo-end, #chest, #bugreport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 28, 15, 0.45);
  backdrop-filter: blur(3px);
  z-index: 10;
}

/* UI size (Settings → Display): scale only the centered panel card, never the full-screen
   dim backdrop — so shrinking a too-large screen leaves no gap. --ui-scale set in applyUiScale(). */
#shop > *, #stand > *, #wardrobe > *, #settings > *, #admin > *, #help > *, #landmap > *, #navmap > *, #adopt > *, #craft > *, #quest > *, #achievements > *, #demo-end > *, #chest > *, #bugreport > * {
  transform: scale(var(--ui-scale, 1));
  transform-origin: center center;
}
/* …and the always-on HUD pieces. They're each pinned to a screen corner, so `zoom`
   scales them in place. The bottom-centre hotbar scales via its own transform (below). */
#hud, #clock, #bag, #minimap, #cropmeter { zoom: var(--ui-scale, 1); }

#shop.hidden, #stand.hidden, #wardrobe.hidden, #settings.hidden, #admin.hidden, #help.hidden, #landmap.hidden, #navmap.hidden, #adopt.hidden, #craft.hidden, #quest.hidden, #achievements.hidden, #demo-end.hidden, #chest.hidden, #bugreport.hidden { display: none; }

/* in-game bug report dialog */
.bug-card { max-width: 460px; display: flex; flex-direction: column; gap: 12px; }
.bug-title { margin: 0; }
.bug-sub { margin: 0; color: #6a5a3e; font-size: 0.92rem; line-height: 1.5; }
#bug-text { width: 100%; font: inherit; padding: 11px 13px; border-radius: 12px; border: 1.5px solid #cdae62;
  background: #fffdf6; color: #3b2f23; resize: vertical; min-height: 96px; }
#bug-text:focus { outline: none; border-color: #b88a2e; }
.bug-cancel { font: inherit; cursor: pointer; border: none; background: none; color: #8a7656; padding: 4px; }
.bug-cancel:hover { color: #5a4636; text-decoration: underline; }

/* Navigation map */
/* the card shrink-wraps the (now landscape) canvas and centres it — no stretch, no side gaps */
#navmap .shop-card { width: auto; max-width: calc(100% - 16px); display: flex; flex-direction: column; align-items: center; max-height: 96vh; }
/* landscape map: locked aspect, grows to the LARGEST size fitting the viewport width/height — fills wide windows */
#navmap-canvas { aspect-ratio: 900 / 640; width: auto; height: auto; max-width: calc(100vw - 44px); max-height: calc(96vh - 128px);
  display: block; margin: 6px auto; border-radius: 12px; background: #2c3a24; cursor: crosshair; box-shadow: inset 0 0 0 2px rgba(90, 61, 38, 0.3); }
.navmap-tools { display: flex; gap: 6px; align-items: center; }
#navmap-zoomin, #navmap-zoomout { min-width: 30px; padding: 4px 9px; font-weight: 800; font-size: 1rem; line-height: 1; }
/* corner minimap (top-right HUD) */
#minimap { position: absolute; top: 14px; right: 18px; width: 215px; height: 150px; z-index: 6; display: none;
  border-radius: 9px; border: 2px solid rgba(90, 61, 38, 0.55); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35); cursor: pointer; background: #2c3a24; }
.navmap-clear { padding: 4px 10px; font-size: 0.8rem; }

#chest .shop-card { width: min(460px, calc(100% - 28px)); display: flex; flex-direction: column; max-height: 86vh; overflow: hidden; }
#chest-body { overflow-y: auto; }
.mk-sign { width: 100%; margin-top: 4px; background: #f4ead2; }

/* inventory sign icon: a 🪧 with the crop's picture sat on the board, so it reads as a sign */
.sign-ic { position: relative; display: inline-block; line-height: 1; }
.sign-ic-crop { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); line-height: 0; }
.sign-ic-crop img.emoji, .sign-ic-crop img { width: 0.5em !important; height: 0.5em !important; margin: 0 !important; }

/* Buy-land confirmation */
#confirm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 28, 15, 0.5);
  backdrop-filter: blur(3px);
  z-index: 40;
}
#confirm.hidden { display: none; }
.confirm-card {
  width: min(340px, calc(100% - 40px));
  padding: 24px;
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 251, 244, 0.98);
  border: 1px solid rgba(156, 113, 78, 0.3);
  box-shadow: 0 22px 56px rgba(40, 25, 5, 0.45);
}
.confirm-icon { font-size: 2.2rem; }
.confirm-card h2 { color: #5a3d26; font-size: 1.3rem; margin: 4px 0 8px; }
.confirm-card p { color: #6f594c; font-size: 1rem; margin: 6px 0 4px; }
.confirm-btns { display: flex; gap: 10px; margin-top: 16px; }
.confirm-btns button { flex: 1; padding: 12px; border: none; border-radius: 13px; font-size: 1rem; font-weight: 800; cursor: pointer; }
#confirm-yes { background: #4ac170; color: #0f3d1f; }
#confirm-yes:hover { background: #5ad683; }
#confirm-no { background: #e7dac6; color: #6a542a; }
#confirm-no:hover { background: #dccbb0; }

/* Disconnected notice */
#disconnected {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 12, 6, 0.78);
  backdrop-filter: blur(4px);
  z-index: 60;
}
#disconnected.hidden { display: none; }
.dc-card {
  width: min(360px, calc(100% - 40px));
  padding: 26px;
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 251, 244, 0.98);
  border: 1px solid rgba(156, 113, 78, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
/* Transient toast nudge — a little hanging wooden sign that slides down from the top */
#toast {
  position: absolute; top: 16px; left: 50%;
  transform: translate(-50%, -22px); opacity: 0;
  z-index: 80; pointer-events: none;
  display: flex; align-items: center; gap: 13px;
  max-width: min(470px, calc(100% - 28px));
  padding: 12px 20px 12px 16px; border-radius: 16px;
  background: linear-gradient(165deg, #9c6b3f, #774c29);
  border: 2px solid #c89b63; color: #fff6e6;
  box-shadow: 0 14px 34px rgba(40, 22, 8, 0.45), inset 0 2px 0 rgba(255, 240, 210, 0.18);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ic { font-size: 1.85rem; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.toast-ic img { width: 1.85rem; height: 1.85rem; vertical-align: middle; }
.toast-body { display: flex; flex-direction: column; gap: 1px; line-height: 1.32; }
.toast-body b { font: 800 14px Inter, system-ui, sans-serif; color: #ffe2a6; }
.toast-body span { font: 600 12.5px Inter, system-ui, sans-serif; color: #fbe8d2; }

/* Operator-pushed "server restarting soon" banner — persistent, top-center, amber
   "system bar" look so it reads as distinct from the brown toast nudge. */
#restart-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; align-items: center; gap: 13px;
  max-width: min(620px, calc(100% - 28px));
  padding: 12px 22px 12px 18px; border-radius: 16px;
  background: linear-gradient(165deg, #f6c54e, #e0982f);
  border: 2px solid #fff0c4; color: #3f2a0c;
  box-shadow: 0 14px 34px rgba(70, 45, 8, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: rb-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
#restart-banner.hidden { display: none; }
#restart-banner .rb-ic { font-size: 1.85rem; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
#restart-banner .rb-ic img { width: 1.85rem; height: 1.85rem; vertical-align: middle; }
#restart-banner .rb-body { display: flex; flex-direction: column; gap: 1px; line-height: 1.32; }
#restart-banner .rb-body b { font: 800 14.5px Inter, system-ui, sans-serif; color: #4a3108; }
#restart-banner .rb-body span { font: 600 12.5px Inter, system-ui, sans-serif; color: #5a3f12; }
@keyframes rb-in { from { transform: translate(-50%, -22px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.dc-icon { font-size: 2.6rem; }
.dc-art { margin: -4px 0 2px; }
.dc-art svg { display: block; margin: 0 auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18)); }
.dc-card h2 { color: #b3402f; font-size: 1.4rem; margin: 6px 0 10px; }
.dc-card p { color: #6f594c; font-size: 0.92rem; line-height: 1.45; margin: 6px 0; }
#dc-refresh {
  margin-top: 16px; width: 100%; padding: 13px; border: none; border-radius: 14px;
  background: #f4b942; color: #4a3210; font-size: 1.05rem; font-weight: 800; cursor: pointer;
}
#dc-refresh:hover { background: #ffc94f; }

.set-section {
  font-weight: 800;
  color: #5a3d26;
  font-size: 0.95rem;
  margin: 14px 0 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(156, 113, 78, 0.16);
}
.set-section:first-child { border-top: none; padding-top: 0; margin-top: 2px; }
.set-help { font-size: 0.84rem; color: #6f594c; line-height: 1.45; }
.set-help p { margin: 6px 0; }
.set-help b { color: #5a3d26; }
/* How-to-Play: a roomy 2-column flow of bordered sections that scroll */
#help .shop-card { width: min(780px, calc(100% - 28px)); display: flex; flex-direction: column; max-height: 90vh; }
#help-body { overflow-y: auto; padding-right: 4px; }
.help-grid { column-count: 2; column-gap: 14px; }
.help-sec { break-inside: avoid; -webkit-column-break-inside: avoid; display: inline-block; width: 100%; margin: 0 0 12px;
  background: rgba(120, 90, 55, 0.06); border: 1px solid rgba(140, 110, 70, 0.22); border-radius: 10px; padding: 8px 11px; }
.help-sec h3 { margin: 0 0 5px; font-size: 0.92rem; color: #5a3d26; }
.help-sec p { margin: 5px 0; }
.help-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.help-keys > div { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.help-keys span { color: #6f594c; }
kbd { display: inline-block; background: #efe4d2; border: 1px solid #c8b48f; border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 5px; font: 600 0.72rem ui-monospace, Menlo, monospace; color: #5a3d26; min-width: 13px; text-align: center; }
@media (max-width: 640px) { .help-grid { column-count: 1; } }
#settings-body .ward-row .ward-label, #admin-body .ward-row .ward-label { flex: 1; }
#settings-body input[type="range"] { flex: 1; accent-color: #c79a4a; }
.hud-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Start screen — gates the game behind a private world name + password */
#start, #account {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #8fcf6e, #5fae57 70%, #4a8f49);
  z-index: 50;
}
#start.hidden, #account.hidden { display: none; }
#account-toggle { color: #2f6f2a; font-weight: 700; }

/* ---- Animated title screen ---------------------------------------------- */
#titlescreen {
  position: absolute; inset: 0; z-index: 60; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #8fd3f0 0%, #bfe9f2 42%, #e3f4cb 72%, #8fd06a 100%);
  font-family: "Comic Sans MS", "Chalkboard SE", "Baloo", system-ui, sans-serif;
}
#titlescreen.hidden { display: none; }

/* Hand-drawn SVG art that replaces the old emoji. Each <svg class="ts-art"> sizes
   to the surrounding font-size (1em), so all the existing animations still apply. */
.ts-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ts-art { display: inline-block; width: 1em; height: 1em; vertical-align: -0.16em; overflow: visible; }
.ts-emojis .ts-art { vertical-align: middle; }
.ts-sub .ts-art { width: 1.3em; height: 1.3em; }
.ts-play .ts-art { margin-right: 6px; }
.ts-grow i .ts-art { width: 100%; height: 100%; vertical-align: bottom; }

.ts-sun {
  position: absolute; top: 7%; right: 11%;
  width: 122px; height: 122px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff6b0, #ffd23f 60%, #ffb02e);
  box-shadow: 0 0 70px 24px rgba(255, 210, 63, 0.55);
  animation: ts-sun-pulse 4s ease-in-out infinite;
}
@keyframes ts-sun-pulse { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.1) rotate(8deg); } }

.ts-cloud { position: absolute; font-size: 3.6rem; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.08)); will-change: left; }
.ts-cloud-a { top: 13%; animation: ts-drift 26s linear infinite; }
.ts-cloud-b { top: 27%; font-size: 2.6rem; animation: ts-drift 36s linear infinite; animation-delay: -12s; }
.ts-cloud-c { top: 8%; font-size: 3rem; animation: ts-drift 31s linear infinite; animation-delay: -22s; }
@keyframes ts-drift { from { left: -16%; } to { left: 116%; } }

.ts-card { position: relative; z-index: 2; text-align: center; padding: 0 20px; margin-bottom: 6%; }
.ts-emojis { font-size: 3.2rem; margin-bottom: 6px; }
.ts-emojis span { display: inline-block; margin: 0 8px; animation: ts-bob 2.2s ease-in-out infinite; animation-delay: var(--d); }
.ts-emojis span:nth-child(2) { animation: ts-jig 1.4s ease-in-out infinite; animation-delay: var(--d); }   /* the tractor jiggles */
.ts-emojis span:nth-child(6) { animation: ts-jig 1.1s ease-in-out infinite; animation-delay: var(--d); }   /* the cat too */
@keyframes ts-bob { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-15px) rotate(8deg); } }
@keyframes ts-jig { 0%, 100% { transform: translateY(0) rotate(-12deg) scale(1); } 50% { transform: translateY(-6px) rotate(12deg) scale(1.12); } }

.ts-title { margin: 2px 0 4px; line-height: 1.02; }
.ts-word { display: inline-block; white-space: nowrap; }
.ts-word + .ts-word { margin-left: 0.35em; }
.ts-letter {
  display: inline-block;
  font-size: clamp(2.4rem, 10.5vw, 5.4rem);
  font-weight: 900; letter-spacing: 1px;
  background: linear-gradient(180deg, #ffd23f 0%, #f0a93a 45%, #e07a2c 74%, #c45a1f 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px rgba(120, 60, 20, 0.22);
  filter: drop-shadow(0 4px 0 rgba(120, 60, 20, 0.32));
  animation: ts-letter 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.08s);
}
@keyframes ts-letter { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-14px) rotate(2deg); } }

.ts-sub { color: #46731f; font-weight: 700; font-size: 1.05rem; margin: 2px 0 20px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55); }

.ts-play {
  font-family: inherit; font-size: 1.4rem; font-weight: 900; color: #fff; cursor: pointer;
  padding: 14px 44px; border: none; border-radius: 999px;
  background: linear-gradient(180deg, #7ed957, #4caf50);
  box-shadow: 0 6px 0 #2f8a3a, 0 14px 24px rgba(20, 80, 20, 0.35);
  animation: ts-play-pulse 1.6s ease-in-out infinite;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.ts-play:hover { transform: translateY(-2px) scale(1.04); }
.ts-play:active { transform: translateY(4px); box-shadow: 0 2px 0 #2f8a3a, 0 6px 12px rgba(20, 80, 20, 0.35); }
@keyframes ts-play-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.ts-buttons { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.ts-coop { background: linear-gradient(180deg, #6aa9e0, #3f7fc4); box-shadow: 0 6px 0 #2c5f9a, 0 14px 24px rgba(20, 40, 80, 0.35); animation-delay: 0.5s; }
.ts-coop:active { box-shadow: 0 2px 0 #2c5f9a, 0 6px 12px rgba(20, 40, 80, 0.35); }
.ts-hint { color: #5a7a3a; font-size: 0.85rem; margin-top: 12px; opacity: 0.85; }

.ts-ground { position: absolute; bottom: 0; left: 0; right: 0; height: 16%; background: linear-gradient(180deg, #79c64e, #57a23f); border-top: 5px solid #4a8f3a; z-index: 1; }
.ts-crop { position: absolute; top: -2.3rem; font-size: 2.7rem; animation: ts-dance 2.4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes ts-dance { 0%, 100% { transform: translateY(0) rotate(-7deg) scaleY(1); } 50% { transform: translateY(-13px) rotate(7deg) scaleY(1.12); } }
.ts-tractor { position: absolute; bottom: 24%; font-size: 3.8rem; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.2)); animation: ts-tractor 9s linear infinite, ts-tractor-bump 0.5s ease-in-out infinite; }
@keyframes ts-tractor { from { left: -12%; } to { left: 112%; } }
@keyframes ts-tractor-bump { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }

/* ---- silly menu critters ---- */
.ts-bird { position: absolute; top: 17%; font-size: 2.3rem; z-index: 1; will-change: left, transform;
  animation: ts-fly-x 15s linear infinite, ts-flap 0.45s ease-in-out infinite; }
@keyframes ts-fly-x { from { left: -12%; } to { left: 112%; } }
@keyframes ts-flap { 0%, 100% { transform: translateY(0) scaleY(1) rotate(-6deg); } 50% { transform: translateY(-12px) scaleY(0.8) rotate(6deg); } }

.ts-chick { position: absolute; top: 33%; font-size: 1.7rem; z-index: 1; will-change: left, transform;
  animation: ts-fly2-x 19s linear infinite, ts-flap 0.5s ease-in-out infinite; animation-delay: -7s, 0s; }
@keyframes ts-fly2-x { from { left: 112%; } to { left: -10%; } }   /* flies the other way */

.ts-bee { position: absolute; top: 44%; font-size: 1.9rem; z-index: 1; will-change: left, transform;
  animation: ts-bee-x 12s linear infinite, ts-bee-y 1.1s ease-in-out infinite; animation-delay: -3s, 0s; }
@keyframes ts-bee-x { from { left: -8%; } to { left: 108%; } }
@keyframes ts-bee-y { 0%, 100% { transform: translateY(0) rotate(10deg); } 50% { transform: translateY(30px) rotate(-10deg); } }

.ts-bfly { position: absolute; font-size: 2rem; z-index: 1; will-change: transform; }
.ts-bfly-a { left: 28%; bottom: 19%; animation: ts-flutter 6s ease-in-out infinite; }
.ts-bfly-b { left: 58%; bottom: 23%; animation: ts-flutter 7.5s ease-in-out infinite; animation-delay: -2.5s; }
@keyframes ts-flutter {
  0%   { transform: translate(0, 0) rotate(-10deg) scale(1); }
  25%  { transform: translate(22px, -28px) rotate(12deg) scale(1.12); }
  50%  { transform: translate(-12px, -44px) rotate(-8deg) scale(0.94); }
  75%  { transform: translate(-28px, -18px) rotate(12deg) scale(1.06); }
  100% { transform: translate(0, 0) rotate(-10deg) scale(1); }
}

.ts-bunny { position: absolute; bottom: 12%; font-size: 2.6rem; z-index: 2; will-change: left, transform;
  animation: ts-bunny-x 11s linear infinite, ts-hop 0.55s ease-in-out infinite; }
@keyframes ts-bunny-x { from { left: -10%; } to { left: 110%; } }
@keyframes ts-hop { 0%, 100% { transform: translateY(0) scaleY(1); } 35% { transform: translateY(-34px) scaleY(1.1); } 70% { transform: translateY(0) scaleY(0.84); } }

/* ---- a crop sprouting, growing, ripening, then getting picked — on a loop ---- */
.ts-grow { position: absolute; top: -2.7rem; width: 2.7rem; height: 2.7rem; }
.ts-grow i {
  position: absolute; left: 0; bottom: 0; width: 100%;
  font-size: 2.7rem; font-style: normal; line-height: 1; text-align: center;
  transform-origin: 50% 100%;   /* grow up out of the soil */
}
.g-seed { animation: ts-grow-seed var(--t, 5s) ease-in-out infinite; animation-delay: var(--d, 0s); }
.g-ripe { opacity: 0; animation: ts-grow-ripe var(--t, 5s) ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes ts-grow-seed {
  0%   { transform: scale(0); opacity: 0; }
  8%   { transform: scaleY(0.3) scaleX(0.5); opacity: 1; }     /* a sprout pokes up */
  45%  { transform: scaleY(1) scaleX(0.92); opacity: 1; }      /* grows tall */
  58%  { transform: scaleY(1) scaleX(0.92); opacity: 0; }      /* hand off to the ripe crop */
  100% { opacity: 0; }
}
@keyframes ts-grow-ripe {
  0%, 50% { opacity: 0; transform: scale(0.55); }
  62%  { opacity: 1; transform: scale(1.18); }                 /* pops into the ripe crop */
  84%  { opacity: 1; transform: translateY(0) scale(1); }
  93%  { opacity: 1; transform: translateY(-12px) scale(1.06); }  /* a little harvest hop */
  100% { opacity: 0; transform: translateY(-26px) scale(0.4); }   /* picked! then it loops */
}

@media (prefers-reduced-motion: reduce) {
  .ts-sun, .ts-cloud, .ts-emojis span, .ts-letter, .ts-play, .ts-crop, .ts-tractor,
  .ts-bird, .ts-chick, .ts-bee, .ts-bfly, .ts-bunny, .ts-grow i { animation: none; }
  .ts-bird, .ts-chick, .ts-bee, .ts-bunny { display: none; }
  .ts-grow .g-seed { opacity: 0; }
  .ts-grow .g-ripe { opacity: 1; }   /* show the ripe crop, no motion */
}
.start-card {
  width: min(380px, calc(100% - 40px));
  padding: 26px 26px 20px;
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.98);
  border: 1px solid rgba(156, 113, 78, 0.25);
  box-shadow: 0 24px 60px rgba(40, 25, 5, 0.45);
  text-align: center;
}
.start-card h2 { font-size: 1.5rem; color: #5a3d26; margin-bottom: 4px; }
.title-emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 4px 6px rgba(40, 25, 5, 0.25));
  animation: title-bob 2.6s ease-in-out infinite;
}
.title-emoji img { width: 3rem; height: 3rem; vertical-align: middle; }
@keyframes title-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.game-title {
  font-size: 2.5rem !important;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 2px !important;
  background: linear-gradient(180deg, #f0a93a 0%, #e07a2c 60%, #c45a1f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
  font-family: "Comic Sans MS", "Chalkboard SE", "Baloo", system-ui, sans-serif;
}
.start-sub { color: #8a7560; font-size: 0.92rem; margin-bottom: 16px; margin-top: 6px; }
.start-card label {
  display: block;
  text-align: left;
  font-weight: 700;
  color: #6a542a;
  font-size: 0.82rem;
  margin: 10px 2px 4px;
}
.start-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(156, 113, 78, 0.4);
  background: #fffdf8;
  font-size: 1rem;
  color: #4a3826;
}
.start-card input:focus { outline: none; border-color: #c79a4a; box-shadow: 0 0 0 3px rgba(199, 154, 74, 0.25); }
.start-remember { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 700; color: #6a542a; margin: 12px 2px 2px; cursor: pointer; user-select: none; }
.start-remember input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; accent-color: #c79a4a; cursor: pointer; transform: scale(1.15); }
.start-error { color: #c0392b; font-weight: 700; font-size: 0.86rem; min-height: 1.1em; margin: 10px 0 4px; }
#start-go, #account-go {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  border-radius: 14px;
  border: none;
  background: #f4b942;
  color: #4a3210;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
#start-go:hover:not(:disabled), #account-go:hover:not(:disabled) { background: #ffc94f; transform: translateY(-1px); }
#start-go:disabled, #account-go:disabled { opacity: 0.6; cursor: default; }
.start-hint { color: #9a866c; font-size: 0.78rem; margin-top: 14px; line-height: 1.4; }

/* Public test realms: one-click join buttons in the lobby */
.public-realms { margin-bottom: 4px; }
.public-realms.hidden { display: none; }
.public-realms-label { text-align: left; font-weight: 700; color: #6a542a; font-size: 0.82rem; margin: 4px 2px 8px; }
.public-realms-list { display: flex; flex-direction: column; gap: 8px; }
.public-realm-btn {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(120, 160, 110, 0.5);
  background: #eef7e8;
  color: #3f5a32;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.public-realm-btn:hover { background: #e0f0d4; border-color: #8fb87a; transform: translateY(-1px); }
.public-realms-or { color: #9a866c; font-size: 0.8rem; font-weight: 700; margin: 14px 0 4px; }

.stand-count { font-weight: 800; color: #5a4636; font-size: 1.1rem; }
#stand-body .empty { color: #8a7560; padding: 10px 0; font-size: 0.95rem; }

/* Load-wagon panel: capacity bar + per-crop steppers */
.wagon-bar { height: 12px; border-radius: 7px; background: #e7dcc6; overflow: hidden; margin: 2px 0 6px; box-shadow: inset 0 1px 2px rgba(0,0,0,.15); }
.wagon-fill { height: 100%; background: linear-gradient(90deg, #e0a23a, #d5564a); transition: width .18s ease; }
.wagon-step { display: inline-flex; align-items: center; gap: 8px; }
.wagon-step .wstep { width: 30px; padding: 4px 0; margin: 0; font-weight: 800; }
.wagon-n { min-width: 22px; text-align: center; font-weight: 800; color: #4a3b30; }
.wagon-foot { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.wagon-foot .buy-btn, .wagon-foot .lm-clear { flex: 1; width: auto; margin-top: 0; }

.shop-card {
  width: min(420px, calc(100% - 40px));
  max-height: 80vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.98);
  border: 1px solid rgba(156, 113, 78, 0.25);
  box-shadow: 0 24px 60px rgba(40, 25, 5, 0.4);
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.shop-head h2 { font-size: 1.2rem; color: #5a3d26; }
.shop-coins { font-weight: 800; color: #6a542a; }

.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(156, 113, 78, 0.16);
}

.shop-row .shop-icon { font-size: 1.9rem; }

.shop-row .shop-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.shop-row .shop-info b { color: #4a3b30; }
.shop-row .shop-info small { color: #8a7560; font-size: 0.78rem; }

.shop-row .buy-btn { margin-top: 0; width: auto; white-space: nowrap; }
.seed-buys { display: flex; gap: 5px; }
.seed-buys .seed-x { padding: 7px 10px; font-size: 0.82rem; }

#shop-close { margin-top: 18px; }

/* ---- Market card grid ---- */
.mk-sub { margin: 12px 0 2px; }
.mk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.mk-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 12px 8px 10px;
  border-radius: 14px;
  background: #f6ecd9;
  border: 1px solid rgba(156, 113, 78, 0.22);
  box-shadow: 0 2px 6px rgba(60, 40, 15, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.mk-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(60, 40, 15, 0.16); background: #fdf5e6; }
.mk-card.owned { background: #e7f1dd; border-color: #9ec48a; }
.mk-card.owned:hover { background: #eef6e6; }
.mk-was { text-decoration: line-through; opacity: 0.5; margin-right: 4px; }
.mk-harvest { margin: 2px 0 8px; padding: 7px 12px; border-radius: 12px; font-weight: 700; color: #7a3b1a;
  background: linear-gradient(90deg,#ffe6a8,#ffd0d0); border: 1px solid #e0a85a; text-align: center; }
.mk-card.locked { opacity: 0.62; }
.mk-card.locked:hover { transform: none; box-shadow: 0 2px 6px rgba(60, 40, 15, 0.08); background: #f6ecd9; }
.mk-ic { font-size: 2rem; line-height: 1.05; }
.mk-ic img.emoji { width: 2rem; height: 2rem; }
.mk-ic img.furn-thumb { width: 68px; height: 68px; object-fit: contain; display: block; margin: -8px auto -2px; }
.mk-name { font-weight: 800; color: #4a3b30; font-size: 0.92rem; line-height: 1.1; }
.mk-desc { font-size: 0.72rem; color: #8a7560; line-height: 1.25; min-height: 2.6em; }
.mk-buy {
  margin-top: 5px; width: 100%; padding: 7px 6px;
  border: 2px solid #cdae62; border-radius: 10px;
  background: #fff6df; color: #6a542a; font-weight: 800; font-size: 0.8rem; cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
}
.mk-buy:hover { background: #ffefc4; transform: translateY(-1px); }
.mk-owned { margin-top: 5px; font-weight: 800; font-size: 0.82rem; color: #4a8f49; }
.mk-locked { margin-top: 5px; font-weight: 700; font-size: 0.72rem; color: #9a8068; }
.mk-card.seed .mk-qty,
.mk-card.cart .mk-qty { display: flex; gap: 4px; width: 100%; margin-top: 2px; align-items: center; }
.mk-q {
  flex: 1; padding: 5px 0;
  border: 1px solid #cdae62; border-radius: 8px;
  background: #fff6df; color: #6a542a; font-weight: 800; font-size: 0.72rem; cursor: pointer;
  transition: background 0.12s ease;
}
.mk-q:hover { background: #ffefc4; }
.mk-price { font-size: 0.68rem; color: #8a7560; margin-top: 1px; }
.mk-sell { margin-top: 14px; }
.mk-sell-row { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-top: 1px solid rgba(156, 113, 78, 0.16); }
.mk-sell-row:first-child { border-top: none; }
.mk-sell-btn { margin-top: 16px; }

/* ----------------------------------------------------------- Hotbar ------ */
#hotbar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) scale(var(--ui-scale, 1));
  transform-origin: bottom center;
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(255, 251, 244, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(156, 113, 78, 0.18);
  box-shadow: 0 12px 30px rgba(60, 40, 15, 0.2);
}

.slot {
  position: relative;
  width: 86px;
  height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #f0e6d6;
  color: #5a4636;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}

.slot:hover { transform: translateY(-2px); background: #e7dac6; }

.slot.selected {
  background: #fff6df;
  border-color: #e7b94a;
  box-shadow: 0 0 0 3px rgba(231, 185, 74, 0.35);
}

.slot .slot-icon { font-size: 1.8rem; line-height: 1; }
.slot .slot-name { font-size: 0.78rem; }

.slot .key {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 0.68rem;
  color: #9a8068;
}

.slot .count {
  position: absolute;
  top: 4px;
  right: 5px;
  min-width: 20px;
  padding: 1px 5px;
  font-size: 0.72rem;
  text-align: center;
  border-radius: 999px;
  background: #7da25f;
  color: #fff;
}

.log-panel { padding: 12px 14px; }

#log { display: grid; gap: 6px; }

.log-entry {
  padding: 8px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.7);
  color: #4a3f33;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* Objective arrow guiding new players to the market */
#store-arrow, #waypoint-arrow {
  position: fixed; z-index: 38; pointer-events: none; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px;
  background: rgba(255, 207, 90, 0.95); color: #5a3d26; font-weight: 700; font-size: 0.82rem;
  border: 1px solid rgba(156, 113, 78, 0.35); border-radius: 999px;
  box-shadow: 0 6px 18px rgba(60, 40, 15, 0.28); white-space: nowrap;
}
#waypoint-arrow { background: rgba(126, 211, 142, 0.96); }   /* a distinct green pin vs the market's amber */
#store-arrow .sa-rot, #waypoint-arrow .sa-rot { display: inline-block; font-size: 0.95rem; line-height: 1; }
#store-arrow .sa-dist, #waypoint-arrow .sa-dist { font-weight: 600; opacity: 0.8; margin-left: 2px; }
/* when pinned to a screen edge, the rotating arrow leads; on-screen it's just a label */
#store-arrow:not(.sa-edge) .sa-rot, #waypoint-arrow:not(.sa-edge) .sa-rot { display: none; }
#onboard { position: fixed; left: 16px; bottom: 64px; z-index: 40; pointer-events: none; }
#onboard.hidden { display: none; }
.onboard-card {
  position: relative; pointer-events: auto; width: 286px; max-width: calc(100vw - 32px);
  border-radius: 18px; padding: 14px 16px 13px;
  background: rgba(255, 251, 244, 0.95); backdrop-filter: blur(8px);
  border: 1px solid rgba(156, 113, 78, 0.22); box-shadow: 0 12px 30px rgba(60, 40, 15, 0.22);
  color: #4a3f33; animation: onboard-in 0.35s ease;
}
@keyframes onboard-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.onboard-card h3 { margin: 0 0 8px; font-size: 1rem; color: #5a3d26; }
.onboard-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 5px; font-size: 0.82rem; line-height: 1.4; }
.onboard-steps b { color: #5a3d26; }
.onboard-steps kbd {
  display: inline-block; min-width: 1.1em; text-align: center; padding: 0 5px;
  font: inherit; font-size: 0.76rem; background: #fff; border: 1px solid rgba(156, 113, 78, 0.3);
  border-radius: 6px; box-shadow: 0 1px 0 rgba(60, 40, 15, 0.15); color: #6a4a2c;
}
.onboard-foot { margin: 10px 0 0; font-size: 0.76rem; color: #7a6453; }
.onboard-x {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; padding: 0;
  border: none; border-radius: 50%; background: rgba(156, 113, 78, 0.12); color: #6a4a2c;
  font-size: 0.8rem; cursor: pointer; line-height: 24px;
}
.onboard-x:hover { background: rgba(156, 113, 78, 0.25); }

@media (max-width: 560px) {
  #hud { top: 10px; left: 10px; width: calc(100% - 20px); }
  .title-panel h1 { font-size: 1.25rem; }
}

/* ---- Cave area transition: a quick fade to black ---- */
#caveFade {
  position: fixed; inset: 0; z-index: 80; pointer-events: none;
  background: #05060a; opacity: 0; transition: opacity 0.3s ease;
}

/* ---- Golden-crop celebration: a brief warm vignette + a popping banner ---- */
#goldFlash {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 224, 120, 0) 38%, rgba(255, 196, 50, 0.5) 100%);
  box-shadow: inset 0 0 200px 70px rgba(255, 205, 80, 0.55);
}
#goldFlash.on { animation: goldFlash 1s ease-out forwards; }
@keyframes goldFlash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

#goldToast {
  position: fixed; top: 26%; left: 50%; z-index: 61; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) scale(0.5); white-space: nowrap; text-align: center;
  font-weight: 800; font-size: clamp(22px, 4vw, 38px); letter-spacing: 0.5px;
  color: #fff3b0; text-shadow: 0 2px 0 #b8860b, 0 3px 10px rgba(120, 80, 0, 0.5), 0 0 22px rgba(255, 210, 80, 0.9);
}
#goldToast.on { animation: goldToast 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes goldToast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  14% { opacity: 1; transform: translate(-50%, -58%) scale(1.12); }
  28% { transform: translate(-50%, -58%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -86%) scale(1); }
}

/* Achievement unlock toast — slides in from the top-right */
#achToast {
  position: fixed; top: 18px; right: 18px; z-index: 62; pointer-events: none; opacity: 0;
  min-width: 210px; max-width: 320px; padding: 12px 16px; border-radius: 14px;
  background: linear-gradient(135deg, #4a3a14, #6b5320); border: 2px solid #f4b942;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 26px rgba(255, 205, 80, 0.35);
  transform: translateX(120%);
}
#achToast.on { animation: achToast 3.4s cubic-bezier(0.2, 0.85, 0.25, 1) forwards; }
.ach-toast-head { color: #ffe08a; font-weight: 800; font-size: 0.72rem; letter-spacing: 0.6px; text-transform: uppercase; }
.ach-toast-body { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.ach-toast-icon { font-size: 1.8rem; line-height: 1; }
.ach-toast-icon img.emoji { width: 1.8rem; height: 1.8rem; vertical-align: -0.3em; }
.ach-toast-name { color: #fffdf6; font-weight: 800; font-size: 1.08rem; }
.ach-toast-reward { margin-top: 4px; color: #ffd86b; font-weight: 700; font-size: 0.86rem; }
@keyframes achToast {
  0% { opacity: 0; transform: translateX(120%); }
  9% { opacity: 1; transform: translateX(-6px); }
  14% { transform: translateX(0); }
  88% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(120%); }
}

/* Achievements panel */
#ach-count { font-weight: 800; color: #6a542a; font-size: 0.95rem; }
#achievements-body { max-height: 62vh; overflow-y: auto; padding: 2px 2px 4px; }

/* Almanac layout fix: make the card ONE flex column with a single scroll region.
   Before, both .shop-card (80vh) and #achievements-body (62vh) scrolled — nested
   scrollbars that, once the level header + 15-row Level-Rewards ladder were added,
   overflowed and pushed the Close button off-screen. Now: header + Close stay pinned,
   only the body scrolls, and the card never exceeds the viewport. */
#achievements .shop-card { display: flex; flex-direction: column; max-height: 88vh; overflow: hidden; }
#achievements .shop-head,
#achievements #almanac-level { flex: 0 0 auto; }
#achievements #achievements-body { flex: 1 1 auto; min-height: 0; max-height: none; }
#achievements #achievements-close { flex: 0 0 auto; margin-top: 12px; }
.ach-cat { text-align: left; font-weight: 800; color: #5a3d26; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; margin: 14px 2px 8px; }
.ach-cat:first-child { margin-top: 2px; }
.ach-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .ach-grid { grid-template-columns: 1fr; } }
.ach-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 11px; border-radius: 12px; border: 1px solid rgba(156, 113, 78, 0.35);
  background: #fffdf8;
}
.ach-card.earned { background: linear-gradient(135deg, #fff7e2, #ffeebf); border-color: #f0c360; }
.ach-card.locked { opacity: 0.66; filter: saturate(0.6); }
.ach-icon { font-size: 1.6rem; line-height: 1; flex: 0 0 auto; width: 1.9rem; text-align: center; }
.ach-icon img.emoji { width: 1.5rem; height: 1.5rem; vertical-align: -0.25em; }
.ach-info { flex: 1 1 auto; min-width: 0; }
.ach-name { font-weight: 800; color: #4a3826; font-size: 0.95rem; }
.ach-desc { color: #8a7560; font-size: 0.78rem; line-height: 1.25; }
.ach-prog { color: #b07d2a; font-weight: 700; font-size: 0.74rem; margin-top: 2px; }
.ach-reward { flex: 0 0 auto; font-weight: 800; font-size: 0.86rem; color: #b8860b; }
.ach-card.earned .ach-reward { color: #2e9e54; }

/* HUD farm-level + XP bar */
.xpbar {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 9px;
  background: rgba(38, 28, 16, 0.62); border: 1px solid rgba(244, 185, 66, 0.4);
  border-radius: 12px; cursor: pointer; user-select: none; max-width: 260px;
}
.xpbar:hover { border-color: #f4b942; }
.xp-level { flex: 0 0 auto; font-weight: 800; font-size: 0.82rem; color: #ffe08a; }
.xp-track { flex: 1 1 auto; height: 9px; border-radius: 6px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.xp-fill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, #8fe06a, #4fd06a); transition: width 0.35s ease; }
.xp-text { flex: 0 0 auto; font-size: 0.7rem; font-weight: 700; color: #d8cdb8; min-width: 58px; text-align: right; }

/* Almanac level header (top of the panel) */
#almanac-level { display: flex; align-items: center; gap: 12px; padding: 4px 2px 12px; }
.alm-badge {
  flex: 0 0 auto; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #f7c948, #e89b1c); color: #4a3210; font-weight: 800; font-size: 1.05rem;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35), 0 3px 8px rgba(150,100,0,0.3);
}
.alm-xpcol { flex: 1 1 auto; min-width: 0; }
.alm-xpcap { font-size: 0.8rem; font-weight: 700; color: #6a542a; margin-bottom: 6px; }
.alm-xptrack { height: 14px; border-radius: 8px; background: #e9e0cd; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.12); }
.alm-xpfill { height: 100%; width: 0%; border-radius: 8px; background: linear-gradient(90deg, #8fe06a, #4fd06a); transition: width 0.4s ease; }

/* Almanac unlock ladder (Level Rewards) */
.alm-ladder { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.alm-lrow { display: flex; align-items: baseline; gap: 9px; padding: 5px 9px; border-radius: 9px; background: #fffdf8; border: 1px solid rgba(156, 113, 78, 0.22); }
.alm-lrow.got { background: linear-gradient(135deg, #f3fbe9, #e7f6d6); border-color: #bfe39a; }
.alm-lrow:not(.got) { opacity: 0.72; }
.alm-ltag { flex: 0 0 auto; font-weight: 800; font-size: 0.78rem; min-width: 52px; color: #9a8068; }
.alm-lrow.got .alm-ltag { color: #2e9e54; }
.alm-litems { flex: 1 1 auto; font-size: 0.82rem; color: #5a4a36; line-height: 1.35; }
.alm-litems img.emoji { width: 1rem; height: 1rem; vertical-align: -0.15em; }

/* Level-up toast — center burst, like the golden one */
#levelToast {
  position: fixed; top: 30%; left: 50%; z-index: 62; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) scale(0.6); text-align: center; white-space: nowrap;
}
#levelToast.on { animation: levelToast 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.lvl-toast-top { font-weight: 800; font-size: clamp(15px, 2.4vw, 22px); color: #ffe08a; text-shadow: 0 2px 8px rgba(120,80,0,0.6); letter-spacing: 0.5px; }
.lvl-toast-num { font-weight: 900; font-size: clamp(30px, 6vw, 56px); color: #fff6cf; text-shadow: 0 2px 0 #b8860b, 0 4px 14px rgba(255,200,80,0.8); }
.lvl-toast-reward { font-weight: 800; font-size: clamp(14px, 2.2vw, 20px); color: #ffd86b; text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
@keyframes levelToast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  14% { opacity: 1; transform: translate(-50%, -56%) scale(1.12); }
  28% { transform: translate(-50%, -56%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -78%) scale(1); }
}

/* ---------------------------------------------------------------------------
   Studio splash — "A Trash Panda Games Original" boot intro. Black background
   matches the logo's own backdrop so the panda blends seamlessly. The panda
   "jumps out of the trash" (pop + overshoot + wobble), then idles with a bob
   while a rainbow tagline shimmers in. showSplash() fades it out to the title.
   --------------------------------------------------------------------------- */
#splash {
  position: absolute; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000; overflow: hidden;
}
#splash.hidden { display: none; }
#splash.fade { animation: splashFade 0.6s ease forwards; }
@keyframes splashFade { to { opacity: 0; visibility: hidden; } }

/* soft purple spotlight behind the logo (echoes the rainbow lights in the art) */
#splash::before {
  content: ""; position: absolute; width: 86vmin; height: 86vmin; border-radius: 50%;
  background: radial-gradient(circle, rgba(96,72,168,0.45), rgba(0,0,0,0) 65%);
  filter: blur(6px); animation: splashGlow 3s ease-in-out both;
}
@keyframes splashGlow {
  0% { opacity: 0; transform: scale(0.6); }
  30% { opacity: 1; }
  80% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0.9; transform: scale(1.06); }
}

.splash-inner { position: relative; display: flex; flex-direction: column; align-items: center; }

#splash-logo {
  width: min(64vmin, 560px); height: auto;
  user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 12px 32px rgba(120,90,210,0.5));
  transform-origin: 50% 82%;
  animation: splashPop 0.9s cubic-bezier(0.18, 1.5, 0.4, 1) both,
             splashBob 2.6s ease-in-out 0.9s infinite;
}
/* the panda springs up out of the can, overshoots, and settles with a wobble */
@keyframes splashPop {
  0%   { transform: translateY(40%) scale(0.55) rotate(-7deg); opacity: 0; }
  55%  { opacity: 1; }
  70%  { transform: translateY(-5%) scale(1.07) rotate(3.5deg); }
  85%  { transform: translateY(0) scale(0.97) rotate(-1.5deg); }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
@keyframes splashBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.4%); } }

#splash-tag {
  margin-top: 16px; font: 900 clamp(18px, 3.4vmin, 30px)/1 Inter, system-ui, sans-serif;
  letter-spacing: 1px; white-space: nowrap;
  background: linear-gradient(90deg, #ff5a5a, #ffae3c, #ffe14a, #6ee86e, #58c7ff, #b06bff, #ff5a5a);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  opacity: 0;
  animation: splashTagIn 0.6s ease 0.75s forwards, splashShimmer 3s linear 0.75s infinite;
}
@keyframes splashTagIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes splashShimmer { to { background-position: 220% center; } }

.splash-skip {
  position: absolute; left: 0; right: 0; bottom: 22px; text-align: center;
  font: 600 12px Inter, system-ui, sans-serif; letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,0.4); opacity: 0;
  animation: splashTagIn 0.5s ease 1.7s forwards;
}

/* ---------------------------------------------------------------------------
   Demo / sample build — the DEMO badge (HUD) + the end-of-sample card.
   --------------------------------------------------------------------------- */
#demo-badge {
  pointer-events: auto; cursor: pointer; user-select: none; align-self: flex-start;
  padding: 5px 11px; border-radius: 999px;
  font: 800 0.72rem/1 Inter, system-ui, sans-serif; letter-spacing: 1.2px;
  color: #3b2f23; background: linear-gradient(135deg, #ffe14a, #ff9e3c);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: 0 3px 10px rgba(150,90,0,0.35), inset 0 0 0 1px rgba(0,0,0,0.06);
  animation: demoPulse 2.4s ease-in-out infinite;
}
#demo-badge:hover { filter: brightness(1.05); }
#demo-badge.hidden { display: none; }
@keyframes demoPulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(150,90,0,0.35), inset 0 0 0 1px rgba(0,0,0,0.06); }
  50% { box-shadow: 0 3px 16px rgba(255,170,40,0.7), inset 0 0 0 1px rgba(0,0,0,0.06); }
}

#demo-end { z-index: 50; }   /* above the shop, in case they level up with it open */
.demo-end-card { width: min(440px, calc(100% - 36px)); text-align: center; }
.demo-end-emoji { font-size: 3rem; line-height: 1; margin-bottom: 4px; }
.demo-end-card h2 { font-size: 1.45rem; color: #5a3d26; margin: 4px 0 12px; }
.demo-end-card p { color: #6a5a3e; line-height: 1.55; margin: 0 0 12px; }
.demo-end-card .demo-end-thanks { font-weight: 700; color: #8a6a3a; }
.demo-end-card .buy-btn { margin-top: 6px; }

/* ---- One-time welcome popup (brand-new players) ------------------------- */
#welcomepopup {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(38, 28, 12, 0.42); backdrop-filter: blur(3px);
  padding: 16px;
}
#welcomepopup.hidden { display: none; }
.welcome-card {
  width: 470px; max-width: 100%; padding: 28px 34px; text-align: center;
  background: rgba(255, 251, 244, 0.985);
  border: 1px solid rgba(156, 113, 78, 0.22);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(60, 40, 15, 0.34);
  font-family: 'Inter', system-ui, sans-serif; color: #3a2f28;
}
.welcome-card svg { display: inline-block; }
.wc-mascot { width: 70px; height: 70px; margin-bottom: 2px; }
.wc-crops { margin: 6px 0 12px; display: flex; justify-content: center; gap: 6px; }
.wc-crops svg { width: 30px; height: 30px; }
.wc-title {
  font-family: "Comic Sans MS", "Chalkboard SE", "Baloo 2", system-ui, sans-serif;
  font-size: 28px; font-weight: 800; color: #5a3d26; line-height: 1.1;
}
.wc-by { margin-top: 8px; font-size: 14px; color: #8a7058; font-weight: 600; }
.wc-by b { color: #6a4a2e; }
.wc-ftp {
  display: inline-block; margin-top: 11px; padding: 3px 12px; border-radius: 999px;
  background: #eaf6df; color: #3f7e34; font-size: 12px; font-weight: 800;
  letter-spacing: 0.4px; text-transform: uppercase; border: 1px solid rgba(70, 140, 55, 0.3);
}
.wc-rule { height: 1px; background: linear-gradient(90deg, transparent, rgba(156, 113, 78, 0.28), transparent); margin: 15px 0 14px; }
.wc-p { font-size: 14.5px; line-height: 1.62; color: #5a4a3c; margin: 0 4px; }
.wc-p + .wc-p { margin-top: 11px; }
.wc-bug { color: #b3502f; font-weight: 700; white-space: nowrap; }
.wc-bug svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 1px; }
.wc-enjoy { margin-top: 15px; font-weight: 600; color: #6a4a2e; }
.wc-sprout { width: 17px; height: 17px; vertical-align: -4px; margin-left: 2px; }
.wc-discord {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 15px;
  padding: 10px 20px; border-radius: 999px; background: #5865F2; color: #fff;
  font-size: 15.5px; font-weight: 800; text-decoration: none;
  box-shadow: 0 6px 15px rgba(88, 101, 242, 0.42);
}
.wc-discord svg { width: 21px; height: 21px; fill: #fff; }
.wc-support { margin-top: 17px; font-weight: 600; color: #6a4a2e; }
.wc-heart { width: 16px; height: 16px; vertical-align: -3px; margin-left: 3px; }
.wc-coffee {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 11px;
  padding: 10px 22px; border-radius: 999px; background: #ffdd00; color: #3a2f28;
  font-size: 15.5px; font-weight: 800; text-decoration: none;
  box-shadow: 0 6px 15px rgba(214, 170, 0, 0.4);
}
.wc-coffee-i { width: 22px; height: 22px; }
.wc-btn {
  margin-top: 21px; cursor: pointer; border: none; font-family: inherit;
  font-size: 17px; font-weight: 800; color: #fff; padding: 13px 46px; border-radius: 999px;
  background: linear-gradient(180deg, #74c25c, #4f9e47);
  box-shadow: 0 6px 0 #3c7d37, 0 10px 18px rgba(60, 120, 40, 0.35);
}
.wc-btn:active { transform: translateY(2px); box-shadow: 0 4px 0 #3c7d37, 0 6px 12px rgba(60, 120, 40, 0.35); }
