/* Potato Clicker – its own earthy Swedish forest look (owner's wish), not the neon style of the
   other games. The top bar stays the same as on every page. */

.potato-page {
  /* Forest colours */
  --pine-night: #12221a;     /* page background */
  --pine: #1b3324;           /* shop panel */
  --moss: #6f9a3c;
  --moss-light: #a9c76a;
  --birch: #f1ece0;          /* paper / light text */
  --bark: #4a3019;           /* dark wood edges */
  --wood: #8a5a33;
  --wood-light: #b57d48;
  --falu: #9b2d20;           /* Falu red, like the red cottages */
  --cloudberry: #f4a93c;     /* highlights: numbers, own row */
  --leaf-text: #c9d3bb;      /* softer text */

  color: var(--birch);
  background-color: var(--pine-night);
  background-image:
    radial-gradient(50rem 25rem at 85% 0%, rgba(111, 154, 60, 0.18), transparent),
    radial-gradient(50rem 25rem at 10% 20%, rgba(244, 169, 60, 0.08), transparent);
}

/* ---------- Titles ---------- */

.potato-title {
  margin: 0 0 1.25rem;
  font-weight: 900;
  font-size: 2.2rem;
  line-height: 1.1;
  color: var(--birch);
  text-shadow: 0 3px 0 var(--falu);
}

.potato-page .player-box strong {
  color: var(--cloudberry);
}

/* ---------- Layout: potato left, shop right (stacked on narrow screens) ---------- */

.clicker {
  display: grid;
  gap: 1rem;
}

@media (min-width: 760px) {
  .clicker {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }

  /* The game fills the window: the potato stays put and only the shop scrolls (Cookie Clicker's way) */
  .clicker:not(.is-fullscreen) {
    height: max(34rem, calc(100svh - 10.5rem));
  }

  .clicker:not(.is-fullscreen) .farm,
  .clicker:not(.is-fullscreen) .shop {
    min-height: 0;
    overflow-y: auto;
  }

  .clicker:not(.is-fullscreen) .farm {
    overflow: hidden;
  }
}

.yard {
  display: none;
}

/* Title, name and the bug button on ONE thin row, so the game gets the window's height */
.potato-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 1.2rem;
  margin-bottom: 0.6rem;
}

.potato-head > *,
.potato-head .player-box.game-player {
  margin: 0;
  position: static;
}

/* A big screen with a mouse: the game is wider than the page and has a strip of ground between the potato and the
   shop (it also leaves the info box its own room). One row of little figures per building you own stands on it. */
@media (min-width: 1200px) and (hover: hover) and (pointer: fine) {
  .clicker {
    grid-template-columns: minmax(0, 1.1fr) 22rem minmax(0, 0.9fr);   /* (fullscreen too: the strip stays there - owner, 2026-11-10) */
  }

  .clicker:not(.is-fullscreen) {
    --clicker-width: min(1500px, calc(100vw - 3rem));
    width: var(--clicker-width);
    margin-left: calc(50% - var(--clicker-width) / 2);
  }

  .clicker .shop {
    grid-column: 3;
  }

  /* Grass on top, dark soil with pebbles and roots under it */
  .clicker .yard {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    min-height: 0;
    padding: 2.4rem 0.5rem 0.5rem;
    border: 3px solid var(--bark);
    border-radius: 18px;
    overflow: hidden;
    background:
      linear-gradient(#8bb34a, #6f9a3c 55%, #55802f) 0 0 / 100% 2.2rem no-repeat,
      radial-gradient(ellipse 0.7rem 0.45rem at 22% 22%, #7d6a55 0 99%, transparent),
      radial-gradient(ellipse 0.5rem 0.35rem at 74% 36%, #6e5b47 0 99%, transparent),
      radial-gradient(ellipse 0.6rem 0.4rem at 40% 58%, #856f58 0 99%, transparent),
      radial-gradient(ellipse 0.7rem 0.45rem at 80% 74%, #7d6a55 0 99%, transparent),
      radial-gradient(ellipse 0.5rem 0.35rem at 28% 88%, #6e5b47 0 99%, transparent),
      linear-gradient(#6a4a2c, #4a3320);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
    pointer-events: none;
  }
}

/* One row per building: the figures overlap a little, the row shrinks when many buildings are owned */
.yard-row {
  display: flex;
  flex: 1 1 0;
  align-items: flex-end;
  min-height: 0;
  max-height: 2.6rem;
  padding-left: 0.6rem;
}

.yard-row img {
  height: 100%;
  aspect-ratio: 1;
  margin-left: -0.55rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(30, 18, 8, 0.6));
}

.yard-row img:first-child {
  margin-left: 0;
}

/* ---------- The potato in the forest ---------- */

.farm {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 30rem;
  padding: 1.25rem 1rem 6rem;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(to bottom, #2f5a45, #1f3d2c 70%);
  border: 3px solid var(--bark);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  isolation: isolate;                   /* a stacking context of its own, so ::before can lie behind ALL the box's contents */
}

/* STRUMPOKALYPSEN: once the first step has happened (potatoclicker.js sets .is-strumpor while save.wrath > 0 - the same
   moment the Fritidslärare's picture first changes) a worn-clothes pattern fades in over a minute as the box's wallpaper. The owner's
   picture made seamless (assets/images/strumpor-bakgrund.webp, 512 px), repeating; see-through (--strumpor-alpha) so it
   melts in behind the potato, the water and the falling potatoes. Behind everything (z-index -1), never takes a click. */
.farm::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 15px;
  pointer-events: none;
  background: url("assets/images/strumpor-bakgrund.webp") 0 0 / 320px 320px repeat;
  opacity: 0;
  transition: opacity 60s ease;         /* in VERY slowly, over a minute - "something is creeping in" (owner, 2026-11-10) */
}

.clicker {
  --strumpor-alpha: 0.24;               /* how strong the wallpaper is (see-through): the potato box AND the shop */
}

.farm.is-strumpor::before {
  opacity: var(--strumpor-alpha);
}

/* The shop's background gets the same wallpaper. It scrolls, so no pseudo-element: the picture is a background layer
   under a pine-coloured veil whose see-through-ness is a registered number (--strumpor-fade) that can fade. */
@property --strumpor-fade {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

.shop {
  background:
    linear-gradient(rgb(27 51 36 / calc(1 - var(--strumpor-fade))), rgb(27 51 36 / calc(1 - var(--strumpor-fade)))),
    url("assets/images/strumpor-bakgrund.webp") 0 0 / 320px 320px repeat var(--pine);
  transition: --strumpor-fade 60s ease;  /* the same minute as the potato box */
}

.shop.is-strumpor {
  --strumpor-fade: var(--strumpor-alpha);
}

@media (prefers-reduced-motion: reduce) {
  .farm::before { transition: none; }
  .shop { transition: none; }
}

/* While a GOOD Golden Potato effect runs (potatoclicker.js sets .is-boosted): the box glows warm gold from the
   edges, like an inner glow, and breathes slowly - "the power is on, use it!". A layer of its own on top of the
   picture (pointer-events none: never in the way of a click), under the corner buttons (z-index 3). */
.farm::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 15px;                  /* the box's radius minus its border */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;        /* in and out softly, not like a switch */
  box-shadow:
    inset 0 0 24px 6px rgba(255, 222, 90, 0.9),
    inset 0 0 80px 20px rgba(255, 176, 40, 0.6),
    inset 0 0 160px 40px rgba(255, 140, 20, 0.32);
}

.farm.is-boosted::after {
  opacity: 1;
  animation: farm-glow 2.4s ease-in-out infinite;
}

@keyframes farm-glow {
  0%, 100% { opacity: 0.8; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .farm.is-boosted::after { animation: none; }
}

.forest {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 30%;
  pointer-events: none;
}

/* The falling potatoes (rain.js): behind everything in the farm, never in the way of a click.
   .shower = Cookie Clicker's "cookie shower": a 512 px tile full of potatoes (made by rain.js) sliding down
   60 px a second, on and on. A transform animation: the browser moves it by itself, nothing is redrawn. */
.shower {
  position: absolute;
  top: -512px;
  left: 0;
  width: 100%;
  height: calc(100% + 512px);
  background-repeat: repeat;
  background-size: 512px 512px;
  opacity: 0.55;                        /* background: the numbers in front stay easy to read */
  pointer-events: none;
  will-change: transform;
  animation: shower-fall 8.533s linear infinite;   /* 512 px / 60 px a second */
}

.shower[hidden] {
  display: none;
}

@keyframes shower-fall {
  to { transform: translateY(512px); }
}

@media (prefers-reduced-motion: reduce) {
  .shower {
    display: none;
  }
}

.rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tree-far { fill: #1a3524; }
.tree-near { fill: #10241a; }
.moss { fill: #4d7a2e; }

.bank,
.rate,
.hint,
.total {
  position: relative;                 /* above the trees */
  margin: 0;
}

.bank {
  font-weight: 700;
  font-size: 1.2rem;
}

.bank strong {
  display: block;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--cloudberry);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}

/* Every digit of the counting number in a box of its own, all as wide, so it never wobbles sideways as it counts
   (Exo 2's "4" is 2 px wider than the other digits even with tabular-nums – measured at every weight) */
.bank .digit {
  display: inline-block;
  width: 0.62em;
  text-align: center;
}

.rate {
  color: var(--leaf-text);
}

.potato {
  position: relative;
  z-index: 1;
  width: min(85%, 380px);
  margin: 1rem 0 0.5rem;
  padding: 0;
  background: none;
  border: none;
  cursor: default;                      /* the hand shows only over the potato itself (.is-over) */
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.45));
  transition: transform 0.12s;
  /* Fast tapping: no zoom, no scrolling, no grey flash, no text selection. "none", not "manipulation": a finger that
     slides a little while tapping fast used to drag the whole page away on an iPad (owner, 2026-10-30) */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.potato img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;                 /* the button gets the click, the picture can't be dragged away */
}

/* The mouse is over the potato itself (set by potatoclicker.js, which checks the picture's shape) */
.potato.is-over {
  cursor: pointer;
  transform: scale(1.04);
}

.potato:focus-visible {
  outline: 3px dashed var(--cloudberry);
  outline-offset: 6px;
  border-radius: 50%;
}

/* A quick squash on every click (restarted by potatoclicker.js) */
.potato.is-squashed {
  animation: squash 0.14s ease-out;
}

@keyframes squash {
  40% { transform: scale(1.08, 0.9); }
}

.hint {
  font-weight: 700;
  color: var(--birch);
}

.total {
  margin-top: 0.4rem;
  color: var(--leaf-text);
  display: grid;                      /* always two lines, so the panel never changes height when the numbers grow */
}

.total span {
  white-space: nowrap;
}

/* Avancerad info's lines under the potato are plain text lines (as grid rows, every number and every piece of
   text between them got a line of its own) */
.total.advanced-only {
  display: block;
}

.total strong {
  color: var(--cloudberry);
}

/* "+1" texts that float up from the click */
.floaters {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.floater {
  position: absolute;
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--cloudberry);
  text-shadow: 0 2px 0 var(--bark);
  white-space: nowrap;
  animation: float-up 0.9s ease-out forwards;
}

@keyframes float-up {
  from { transform: translate(-50%, -50%); opacity: 1; }
  to   { transform: translate(-50%, -260%); opacity: 0; }
}

/* Sound button: a small round wooden button in the corner */
/* Small round wooden buttons in the farm's top corners: fullscreen (left) and sound (right) */
.farm-button {
  position: absolute;
  top: 0.6rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  color: var(--birch);
  background: var(--wood);
  border: 2px solid var(--bark);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.8;
}

.farm-fullscreen {
  left: 0.6rem;
}

/* "Tillbaka till spelen" sits beside the fullscreen button (a link, not a <button>) */
.farm-back {
  left: 3.8rem;
  text-decoration: none;
}

.farm-mute {
  right: 0.6rem;
}

.farm-button:hover,
.farm-button:focus-visible {
  opacity: 1;
}

.farm-button svg {
  width: 1.3rem;
  height: 1.3rem;
}

/* ---------- Fullscreen: the potato and the shop fill the screen ----------
   (real fullscreen, or a stand-in that covers the browser window on iPhone – js/game-ui.js) */

.clicker.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-content: start;
  overflow-y: auto;                     /* the shop scrolls */
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) calc(0.75rem + env(safe-area-inset-right, 0px))
    calc(0.75rem + env(safe-area-inset-bottom, 0px)) calc(0.75rem + env(safe-area-inset-left, 0px));
  background-color: var(--pine-night);
}

/* Wide screens: the potato stays in view while the shop scrolls beside it – the same layout as the normal box: both
   columns are as high as the (fixed) game, the shop scrolls inside itself. Nothing is sized in vh: on an iPad 100vh is
   taller than what is visible, which pushed the farm's bottom (the water) off the screen and broke the shop's scroll
   (owner, 2026-10-30, after the stand-in fullscreen came to iPad). */
@media (min-width: 760px) {
  .clicker.is-fullscreen {
    overflow: hidden;
    grid-template-rows: minmax(0, 1fr);
  }

  .clicker.is-fullscreen .farm {
    min-height: 0;
    overflow: hidden;
  }

  .clicker.is-fullscreen .shop {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

body.game-fullscreen {
  overflow: hidden;                     /* the page behind must not scroll */
}

/* ---------- Messages (welcome back, start over?) ---------- */

.notice {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 20, 14, 0.7);
}

.notice-box {
  max-width: 22rem;
  padding: 1.25rem;
  color: #3a2716;
  background: var(--birch);
  border: 3px solid var(--wood);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.notice-box {
  text-align: center;
}

.notice-icon {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  margin: -0.25rem auto 0.4rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(40, 24, 10, 0.45));
}

.notice-box h2 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  color: var(--falu);
}

.notice-box p {
  margin: 0 0 1rem;
  white-space: pre-line;                /* a "\n" in the text = a new line (the question before Veckobrevspåminnelse) */
}

.notice-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* ---------- Wooden buttons ---------- */

.wood-button {
  padding: 0.6rem 1.4rem;
  font: inherit;
  font-weight: 800;
  color: #fff6e6;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0 3px, transparent 3px 11px),
    linear-gradient(var(--wood-light), var(--wood));
  border: 2px solid var(--bark);
  border-radius: 10px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 3px 0 var(--bark);
  cursor: pointer;
}

.wood-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 1px 0 var(--bark);
}

.wood-button-light {
  background: linear-gradient(var(--moss-light), var(--moss));
  color: #1c2d12;
}

/* ---------- The shop ---------- */

.shop {
  padding: 1rem;
  border: 3px solid var(--bark);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.shop h2 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--moss-light);
}

.shop h2 + div {
  margin-bottom: 1.25rem;
}

.shop-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--leaf-text);
}

/* Upgrades: small square paper notes with only a picture (like Cookie Clicker's row of icons) */
.upgrades {
  display: grid;
  grid-template-columns: repeat(auto-fill, 3.6rem);
  gap: 0.4rem;
}

/* With a mouse (like Cookie Clicker): only the first row of upgrades (the cheapest) shows; pointing at the row
   opens all of them and the buildings move down while you look – the only thing in the shop that moves.
   Touch screens can't point without tapping, so there every upgrade always shows. */
@media (hover: hover) and (pointer: fine) {
  .upgrades {
    max-height: calc(3.6rem + 4px);     /* one square + its shadow */
    overflow: hidden;
  }
  .upgrades:hover,
  .upgrades:focus-within {
    max-height: none;
  }
}

/* Strumpokalypsen's own rows above the ordinary upgrades (Cookie Clicker's "Switches" and "Research"): at most a
   couple of squares each, always shown (never folded to one row) */
.upgrades.upgrades-special {
  max-height: none;
}

.upgrade {
  display: grid;
  place-items: center;
  padding: 0;
  font: inherit;
  /* The owner's drawn tile: a wooden frame round a dark board, its shadow in the picture (116 x 124) */
  width: 3.6rem;
  height: 3.86rem;
  /* A weak radial glow lightens the dark board (blend "screen" = nearly add); it dies out before the wooden frame */
  background:
    radial-gradient(circle at 50% 47%, rgba(170, 220, 190, 0.7) 0%, rgba(120, 170, 150, 0.35) 45%, rgba(0, 0, 0, 0) 68%),
    url("assets/images/upgrade/ruta-4x.png") center / 100% 100% no-repeat;
  background-blend-mode: screen, normal;
  border: 0;
  cursor: pointer;
  /* A finger held on it shows the info box: no text selection, no "save picture" menu */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.upgrade-icon {
  position: relative;
  font-size: 1.9rem;
  line-height: 1;
}

/* The building it makes better, with the upgrade's own emoji small in the corner */
.upgrade-icon.has-picture img {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.25rem;
  object-fit: contain;                  /* the Golden Potato's picture isn't square */
  filter: drop-shadow(0 1px 1px rgba(40, 24, 10, 0.5));
  pointer-events: none;
}

/* An upgrade with only an emoji (Tusen spadar, Lånekläder …): the glyph sits low in its line box, so it is
   lifted like the pictures (margin-bottom) and a touch more – it sat too low on the board (owner, 2026-10-26) */
.upgrade > .upgrade-icon:not(.has-picture) {
  margin-bottom: 0.45rem;
}

.upgrade-badge {
  position: absolute;
  right: -0.35rem;
  bottom: -0.3rem;
  font-size: 1rem;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
}

/* Buildings: wooden planks with picture, name, price and how many you own – nothing else (the rest is
   in the info box). Every row is the same height, so nothing jumps when numbers grow. */
.buildings {
  display: grid;
  gap: 0.4rem;
}

.building {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  height: 5rem;
  padding: 0 0.9rem 0 0;    /* no padding left/top/bottom: the picture reaches the plank's edge */
  overflow: hidden;
  font: inherit;
  text-align: left;
  color: #fff6e6;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 13px),
    linear-gradient(var(--wood-light), var(--wood));
  border: 2px solid var(--bark);
  border-radius: 10px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 3px 0 var(--bark);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.building-icon {
  font-size: 2rem;
  text-align: center;
}

/* The owner's drawings (128 x 128) fill the plank's whole height (owner, like Cookie Clicker's big pictures) */
.building-icon {
  align-self: stretch;
  display: grid;
  place-items: center;
}

.building-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(40, 24, 10, 0.5));
  pointer-events: none;
}

.building-name,
.building-price {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.building-name {
  font-weight: 900;
  font-size: 1.45rem;
  line-height: 1.15;
  text-shadow: 0 2px 0 var(--bark);
}

/* The price: green when you can afford it, red when you can't (like Cookie Clicker) */
.building-price {
  font-weight: 800;
  font-size: 0.95rem;
  color: #b6f27c;
  text-shadow: 0 1px 0 var(--bark), 0 0 3px rgba(40, 24, 10, 0.8);
}

.building.cant-afford .building-price {
  color: #ff9d8a;
}

/* ---------- Köp / Sälj and 1 · 10 · 100 ---------- */
/* Two little rows of wooden buttons beside the "Köp" heading. The chosen button is lit (cloudberry, dark letters),
   so it is clear at a glance what the next tap does. Sälj also paints the rows Falu red. */
.buy-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.8rem;
  margin-bottom: 0.6rem;
}

.shop .buy-head h2 {
  margin: 0;
}

.shop .buy-head .buy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin: 0;
}

.choice-group {
  display: flex;
  overflow: hidden;
  border: 2px solid var(--bark);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--bark);
}

.choice {
  min-width: 2.75rem;
  min-height: 2.75rem;           /* a finger-sized target */
  padding: 0 0.7rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--leaf-text);
  background: var(--bark);
  border: 0;
  cursor: pointer;
}

.choice + .choice {
  border-left: 2px solid var(--wood);
}

.choice:hover {
  background: #5c3d20;
}

.choice[aria-pressed="true"] {
  color: #2d1a08;
  background: linear-gradient(var(--cloudberry), #e08f22);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 246, 230, 0.55);
}

.choice.is-sell[aria-pressed="true"] {
  color: #fff6e6;
  background: linear-gradient(#c9412f, var(--falu));
  text-shadow: 0 1px 0 var(--bark);
}

.choice:focus-visible {
  outline: 3px dashed var(--birch);
  outline-offset: -4px;
}

/* Sälj: the planks turn red and the price becomes what you get back */
.buildings.is-selling .building {
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.07) 0 3px, transparent 3px 13px),
    linear-gradient(#b8503f, var(--falu));
  border-color: #5a1810;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 3px 0 #5a1810;
}

.buildings.is-selling .building-price,
.buildings.is-selling .building.cant-afford .building-price {
  color: #ffe2a8;
}

/* How many you own: big and faded at the right end */
.building-count {
  font-size: 2.4rem;
  font-weight: 900;
  color: rgba(255, 226, 176, 0.55);
  text-shadow: 0 2px 0 rgba(40, 24, 10, 0.6);
}

.upgrade:active,
.building:active {
  transform: translateY(2px);
}

/* Too expensive right now: faded (still clickable – nothing happens) */
.cant-afford {
  opacity: 0.7;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

.cant-afford:active {
  transform: none;
}

/* An upgrade you can't afford: much fainter and nearly grey, so one glance tells which squares are buyable
   (owner, 2026-11-11: the difference was hard to see). The buildings keep their red price. */
.upgrade.cant-afford {
  opacity: 0.4;
  filter: grayscale(0.85) brightness(0.75);
}

/* Grey because the whole chosen amount (10 or 100) is too much, but a tap still buys as many as you can afford */
.cant-afford.is-partial {
  cursor: pointer;
}

/* ---------- Text under the game + highscore list ---------- */

.small-print {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--leaf-text);
}

.potato-page .link-button {
  color: var(--moss-light);
}

.potato-page .scoreboard th {
  font-style: normal;
  color: var(--leaf-text);
  border-bottom-color: var(--moss);
}

.potato-page .scoreboard td {
  border-bottom-color: rgba(169, 199, 106, 0.2);
}

.potato-page .scoreboard td.col-score {
  font-style: normal;
  color: var(--cloudberry);
}

.potato-page .scoreboard .me td {
  background: rgba(244, 169, 60, 0.14);
}

.potato-page .scoreboard .me .col-name {
  color: var(--cloudberry);
}

/* ---------- Under the game: "Topplista | Medaljer" (js/medals.js setupMedalTab) ----------
   The forest look instead of the site's neon tabs: the open tab is the old "Topplista" heading (birch with a
   Falu red shadow) over a moss line, the other one is dimmed. With medals off only "Topplista" is left – then
   it reads as that heading, without the line. */

.potato-page .below-tabs {
  gap: 0.5rem 1.5rem;
  margin: 2.5rem 0 1.25rem;
}

.potato-page .below-tabs .game-tab {
  padding: 0 0.1rem 0.2rem;
  font-style: normal;
  font-size: 1.6rem;
  line-height: 1.1;
  text-transform: none;
  color: var(--leaf-text);
  border-bottom: 3px solid transparent;
}

.potato-page .below-tabs .game-tab[aria-selected="true"] {
  color: var(--birch);
  text-shadow: 0 3px 0 var(--falu);
  border-bottom-color: var(--moss);
}

html:not(.medals-on) .potato-page .below-tabs .game-tab {
  border-bottom-color: transparent;
}

.potato-page .below-tabs .game-tab:focus-visible {
  outline: 3px dashed var(--cloudberry);
  outline-offset: 4px;
}

/* The medal list: birch and cloudberry instead of the neon colours */
.potato-page .my-medal strong,
.potato-page .my-medal-note {
  color: var(--leaf-text);
}

.potato-page .my-medal.is-won strong {
  color: var(--birch);
}

.potato-page .my-medal.is-won .my-medal-note,
.potato-page .medal-stars {
  color: var(--cloudberry);
}

/* The medal's dark disc in forest green (the shared picture's disc is the site's night blue) */
.potato-page .medal-picture circle[r="14"] {
  fill: #1f3d2c;
}

/* Not won yet: plain grey, not the site's grey-purple */
.potato-page .medal-picture.is-locked {
  filter: grayscale(1);
}

/* "Ny medalj!" (the small box at the top, js/medals.js): a dark forest note with round corners, not slanted */
.potato-page .medal-toast {
  color: var(--birch);
  background: rgba(18, 34, 26, 0.94);
  border-radius: 12px;
  transform: translate(-50%, -140%);
}

.potato-page .medal-toast.is-shown {
  transform: translate(-50%, 0);
}

.potato-page .medal-toast > * {
  transform: none;
}

.potato-page .medal-toast-label,
.potato-page .medal-toast strong {
  font-style: normal;
}

.potato-page .medal-toast-label {
  color: var(--cloudberry);
}

/* What a medal is for (the box when pointing at one, js/medals.js): the shop's info box look */
.potato-page .medal-tip {
  color: var(--birch);
  background: rgba(18, 34, 26, 0.97);
  border-color: var(--wood);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.potato-page .medal-tip-title {
  font-style: normal;
}

.potato-page .my-medal:focus-visible {
  outline-color: var(--cloudberry);
}

@media (prefers-reduced-motion: reduce) {
  .potato,
  .potato.is-squashed,
  .floater {
    animation: none;
    transition: none;
  }
  .floater {
    display: none;
  }
  .potato-page .medal-toast,
  .potato-page .medal-toast.is-shown {
    transform: translate(-50%, 0);
  }
}

/* ---------- "???" buildings (like Cookie Clicker: a dark shape and the price) ---------- */

.building.is-mystery {
  color: #d8c7a8;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 13px),
    linear-gradient(#5e4129, #43301d);
}

.building.is-mystery .building-name {
  color: #b8a586;
}

.building.is-mystery .building-icon {
  filter: brightness(0) opacity(0.6);   /* the emoji becomes a dark silhouette */
}

.building.is-mystery.cant-afford {
  opacity: 0.75;
  filter: none;
}

/* ---------- The statistics page (a dialog over the game) ---------- */

.shop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.shop-top .advanced-toggle {
  margin: 0;
}

.stats-button {
  min-height: 2.75rem;
  padding: 0 1rem;
  font-size: 1rem;
}

.stats {
  width: min(62rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--birch);
  background: var(--pine);
  border: 3px solid var(--bark);
  border-radius: 18px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.4);
}

.stats[open] {
  display: flex;
  flex-direction: column;
}

.stats::backdrop {
  background: rgba(10, 20, 14, 0.78);
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  background: linear-gradient(var(--wood-light), var(--wood));
  border-bottom: 3px solid var(--bark);
}

.stats-head h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #fff6e6;
  text-shadow: 0 2px 0 var(--bark);
}

.stats-close {
  min-height: 2.75rem;
}

/* The cards: as many columns as fit, every card as tall as its own numbers */
.stats-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  align-items: start;
  gap: 0.9rem;
  padding: 1rem;
  overflow-y: auto;
}

.stat-card {
  min-width: 0;
  padding: 0.7rem 0.9rem 0.9rem;
  background: rgba(0, 0, 0, 0.22);
  border: 2px solid var(--bark);
  border-radius: 12px;
}

.stat-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--moss-light);
}

.stat-buildings {
  grid-column: 1 / -1;                    /* the building table gets the whole width */
}

.stat-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.2rem 1rem;
  margin: 0;
}

.stat-list dt {
  color: var(--leaf-text);
  white-space: nowrap;
}

.stat-list dd {
  margin: 0;
  text-align: right;
}

.stat-list strong {
  font-weight: 900;
  color: var(--cloudberry);
}

.stat-list small {
  display: block;
  font-size: 0.78rem;
  color: var(--leaf-text);
  opacity: 0.8;
}

.stat-list small:empty {
  display: none;
}

.stat-buildings .stat-list {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-scroll {
  overflow-x: auto;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  white-space: nowrap;
}

.stat-table th {
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
  color: var(--leaf-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.stat-table td {
  padding: 0.28rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-variant-numeric: tabular-nums;
}

.stat-table th:first-child,
.stat-table td.stat-name {
  text-align: left;
  font-weight: 800;
  color: #fff6e6;
}

@media (max-width: 480px) {
  .stats {
    width: calc(100vw - 0.75rem);
  }

  .stats-body {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.6rem;
  }
}

/* ---------- Avancerad info ---------- */

.advanced-toggle {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin: -0.25rem 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--leaf-text);
  cursor: pointer;
}

/* The checkbox drawn as a small wooden switch */
.advanced-toggle input {
  appearance: none;
  position: relative;
  width: 2.6rem;
  height: 1.4rem;
  margin: 0;
  background: var(--bark);
  border: 2px solid var(--wood);
  border-radius: 1rem;
  cursor: pointer;
}

.advanced-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.9rem;
  height: 0.9rem;
  background: var(--birch);
  border-radius: 50%;
  transition: transform 0.15s;
}

.advanced-toggle input:checked {
  background: var(--moss);
}

.advanced-toggle input:checked::after {
  transform: translateX(1.2rem);
}

.advanced-toggle input:focus-visible {
  outline: 2px dashed var(--cloudberry);
  outline-offset: 2px;
}

/* Hidden unless the switch is on */
.clicker:not(.show-advanced) .advanced-only {
  display: none;
}

/* The best buy (lowest "lönar sig efter") gets a green glow */
.show-advanced .is-best {
  outline: 3px solid var(--moss-light);
  outline-offset: 2px;
}

/* ---------- The Golden Potato ---------- */

.golden-potato {
  position: fixed;
  z-index: 50;                          /* above the game, under the top bar (100) and live messages */
  width: 130px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  filter: drop-shadow(0 0 14px rgba(255, 210, 63, 0.9));
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.golden-potato img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.golden-potato:focus-visible {
  outline: 3px dashed var(--cloudberry);
  outline-offset: 4px;
}

/* THE GLEAM (owner, 2026-11-05): a band of light sweeps over the potato now and then. It is the picture itself used
   as a mask, so the light only falls on the potato, never on the see-through corners. --gleam = its colour. */
.golden-potato::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 44%, var(--gleam, rgba(255, 255, 240, 1)) 50%, transparent 56%)
    no-repeat;
  background-size: 300% 100%;
  background-position: 100% 0;          /* 100 % = the light just left of the potato, 0 % = just right of it */
  mix-blend-mode: screen;
  -webkit-mask: url("assets/images/potatis-guld.png") center / 100% 100% no-repeat;
  mask: url("assets/images/potatis-guld.png") center / 100% 100% no-repeat;
  animation: golden-gleam 3s ease-in-out 0.4s infinite;
}

@keyframes golden-gleam {
  0%   { background-position: 100% 0; }
  35%  { background-position: 0% 0; }       /* the sweep (~1 s), then a pause before the next */
  100% { background-position: 0% 0; }
}

/* THE WRATH POTATO (golden.js, during Strumpokalypsen): the same picture painted angry red, a red glow and a
   dimmer, redder gleam. A stand-in until the owner draws one. */
.golden-potato.is-wrath {
  --gleam: rgba(255, 170, 150, 0.8);
  filter: drop-shadow(0 0 14px rgba(220, 40, 30, 0.95));
}

.golden-potato.is-wrath img {
  filter: hue-rotate(-48deg) saturate(1.5) brightness(0.62) contrast(1.2);
}

/* Its 13 seconds (longer with Fyrklöver/Stjärnfall: --golden-life, set by potatoclicker.js): fades in, wobbles
   and shines, fades out at the end (GOLDEN_LIFE_SECONDS) */
.golden-potato.is-alive {
  animation: golden-life var(--golden-life, 13s) linear forwards, golden-wobble 1.6s ease-in-out infinite;
}

@keyframes golden-life {
  0%   { opacity: 0; }
  6%   { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes golden-wobble {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50%      { transform: rotate(8deg) scale(1.08); }
}

/* "Potatisdagen! Allt odlar ×7 i 77 s" where it was clicked */
.golden-message {
  position: fixed;
  z-index: 51;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  color: #3a2716;
  text-align: center;
  white-space: nowrap;
  background: var(--birch);
  border: 3px solid #e0a800;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(255, 210, 63, 0.8);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: golden-pop 3.5s ease-out forwards;
}

.golden-message strong {
  font-size: 1.3rem;
  color: var(--falu);
}

/* "Forskningen har börjat" / "Ny upptäckt!": a quiet box at the top, the same wooden look as the golden message */
.research-message {
  position: fixed;
  z-index: 51;
  top: 4.2rem;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;               /* not squeezed to half the screen by left: 50 % */
  max-width: calc(100vw - 2rem);
  padding: 0.5rem 1rem;
  color: #3a2716;
  text-align: center;
  background: var(--birch);
  border: 3px solid var(--falu);
  border-radius: 12px;
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
}

.research-message strong {
  font-size: 1.1rem;
  color: var(--falu);
}

.research-message.is-showing {
  animation: research-pop 5s ease-out forwards;
}

@keyframes research-pop {
  0%   { opacity: 0; transform: translate(-50%, -30%); }
  8%   { opacity: 1; transform: translate(-50%, 0); }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -20%); }
}

@media (prefers-reduced-motion: reduce) {
  .research-message.is-showing { animation: none; }
}

@keyframes golden-pop {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  10%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -90%); }
}

/* The running boosts, under "per sekund" */
.buffs {
  position: relative;
  margin: 0.3rem 0 0;
  padding: 0.15rem 0.6rem;
  font-weight: 800;
  color: #3a2716;
  background: #ffd23f;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.7);
}

/* The wrath potato's bad luck (Strumpstopp, Strumprån …): the message box in Falu red */
.golden-message.is-bad {
  border-color: var(--falu);
  box-shadow: 0 0 18px rgba(200, 40, 30, 0.75);
}

/* A red potato's GOOD luck = a jackpot: a bigger, golden, shining box that pops in (owner, 2026-11-11) */
.golden-message.is-jackpot {
  padding: 0.7rem 1.4rem;
  background: linear-gradient(#fff3b0, #ffd23f);
  border-color: #b8860b;
  box-shadow: 0 0 34px 6px rgba(255, 210, 63, 0.95);
  animation: jackpot-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.golden-message.is-jackpot strong {
  font-size: 1.8rem;
}

@keyframes jackpot-pop {
  from { transform: translate(-50%, -50%) scale(0.4); }
  to   { transform: translate(-50%, -50%) scale(1); }
}

/* Golden potatoes bursting out of a jackpot (potatoclicker.js goldBurst) */
.gold-burst {
  position: fixed;
  z-index: 50;
  width: 2.4rem;
  margin: -1.2rem 0 0 -1.2rem;
  pointer-events: none;
  animation: gold-burst 1.3s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}

@keyframes gold-burst {
  0%   { transform: translate(0, 0) scale(0.4) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 80px)) scale(1) rotate(var(--spin)); opacity: 0; }
}

/* Lånekläder calls when a red potato comes (the first few times): it glows gold and bounces – the way back to the
   golden ones (potatoclicker.js pointAtPledge) */
.upgrade.is-calling {
  animation: pledge-call 0.8s ease-in-out 4;
}

@keyframes pledge-call {
  0%, 100% { transform: translateY(0); filter: none; }
  50%      { transform: translateY(-6px) scale(1.08); filter: drop-shadow(0 0 10px #ffd23f) brightness(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .golden-message.is-jackpot { animation: none; }
  .upgrade.is-calling { animation: pledge-call 0.8s step-end 4; }
}

@media (prefers-reduced-motion: reduce) {
  .golden-potato.is-alive {
    animation: golden-life var(--golden-life, 13s) linear forwards;
  }

  .golden-potato::after {
    animation: none;
  }
}

/* The sound menu (two small buttons under the sound button) in wood like the other buttons */
.sound-choice {
  color: var(--birch);
  background: var(--wood);
  border-color: var(--bark);
  border-radius: 50%;
}

.sound-choice.is-off {
  opacity: 0.55;
}

/* ---------- The shop's info box (tooltip.js) ----------
   A dark forest note beside the row under the mouse (above it on a phone). It never takes clicks. */

.shop-tip {
  position: fixed;
  z-index: 150;                         /* over the top bar too: it is only there while you point at a row */
  width: min(21rem, calc(100vw - 16px));
  padding: 0.6rem 0.75rem 0.7rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--birch);
  background: rgba(18, 34, 26, 0.97);
  border: 2px solid var(--wood);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.tip-head {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}

.tip-head .building-icon img,
.tip-head .upgrade-icon.has-picture img {
  width: 2.6rem;
  height: 2.6rem;
}

.tip-head .building-icon,
.tip-head .upgrade-icon {
  font-size: 1.8rem;
  text-align: center;
}

.tip-head .upgrade-badge {
  filter: none;
}

.tip-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 900;
}

/* Small tags under the name: "du har 12", "Uppgradering", "Steg 2" (that one in the step's colour) */
.tip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.tip-tag {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--leaf-text);
  background: rgba(181, 125, 72, 0.3);
  border-radius: 4px;
}

.tip-tag[style] {
  color: #1c140c;
  background: var(--tag);
}

.tip-cost {
  align-self: start;
  font-weight: 800;
  white-space: nowrap;
  color: #9be36b;
}

.tip-cost.is-short {
  color: #ff7b6b;
}

/* What it does: plain, on the left, the important word in bold (Cookie Clicker's "twice") */
.tip-effect {
  margin: 0.55rem 0 0;
  font-size: 0.92rem;
  color: var(--birch);
}

.tip-effect b {
  font-weight: 900;
  color: #fff;
}

/* The funny line: on the right, italic in a serif font – the computer's own (Georgia on Windows/Mac, its
   look-alike on Chromebooks), no font file fetched from anywhere */
.tip-quote {
  margin: 0.55rem 0 0;
  font-family: Georgia, "Times New Roman", Tinos, serif;
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: right;
  color: #a9b49c;
}

/* The chain's warning, RED like Cookie Clicker's "Note: …" (its .warning is #c00; a lighter red reads on our dark box) */
.tip-warning {
  margin: 0.5rem 0 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.3;
  color: #ff7a6b;
  background: rgba(220, 40, 30, 0.14);
  border-left: 3px solid #e0402f;
}

/* Lånekläder: how many times (Cookie Clicker: "You've pledged to the elders N times."), above the effect */
.tip-count {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  text-align: center;
  color: var(--leaf-text);
}

.tip-facts {
  display: grid;
  gap: 0.2rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.tip-facts li {
  padding: 0.1rem 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
}

.tip-advice {
  margin: 0.5rem 0 0;
  font-weight: 700;
  color: var(--moss-light);
}

/* The thumbs under the game (js/game-thumbs.js) in the forest look: wooden planks, the three colours kept as moss
   (up), cloudberry (sådär) and Falu red (down) */
.game-thumbs .rating-thumb {
  clip-path: none;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 13px),
    linear-gradient(var(--wood-light), var(--wood));
  border: 2px solid var(--bark);
  border-radius: 8px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 3px 0 var(--bark);
}

.game-thumbs .rating-thumb[data-vote="up"] { color: var(--moss-light); }
.game-thumbs .rating-thumb[data-vote="meh"] { color: #ffd27a; }
.game-thumbs .rating-thumb[data-vote="down"] { color: #ffb3a6; }

.game-thumbs .rating-thumb[data-vote],
.game-thumbs .rating-thumb.is-chosen[data-vote] {
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 13px),
    linear-gradient(var(--wood-light), var(--wood));
}

.game-thumbs .rating-thumb.is-chosen {
  border-color: #ffd27a;                         /* cloudberry: chosen (the keyboard's place is a white ring inside) */
}

.game-thumbs .rating-thanks {
  color: var(--birch);
}

@media (max-width: 480px) {
  .game-thumbs {
    margin-bottom: 2.2rem;                       /* "Tack!" under the thumbs, clear of the text below */
  }
}

/* ---------- Smutsiga strumpmonster (Strumpokalypsen, strumpor-ui.js) ---------- */

/* A layer over the farm box; only the monsters themselves take clicks */
.monsters {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.strump {
  touch-action: none;                   /* three quick taps must not scroll the page (iPad) */
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: var(--strump-size, 2.6rem);     /* the drawing is tall and thin: ~2.6 x 5.5 rem, about the old sock's area */
  transform-origin: 0 0;                      /* strumpor-ui.js turns it round the point it hangs by */
  padding: 0;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.08s linear;
  -webkit-tap-highlight-color: transparent;
}

.strump-picture {
  display: block;
  width: 100%;
  overflow: visible;
  height: auto;
  filter: drop-shadow(0 3px 0 rgba(20, 12, 4, 0.55));
  transform-origin: 50% 100%;                 /* it sways round the point it hangs by */
  animation: strump-bob 1.1s ease-in-out infinite;
}

/* Guldstrumpan: shiny gold, with a glow, so nobody misses it */
.is-gold .strump-picture { filter: drop-shadow(0 0 8px rgba(255, 210, 63, 0.95)) drop-shadow(0 3px 0 rgba(20, 12, 4, 0.55)); }

/* Still crawling in: a bit see-through and wiggling its feet, and it can't be hit yet */
.strump.is-crawling { opacity: 0.8; pointer-events: none; }
.strump.is-crawling .strump-picture { animation: strump-sway 0.9s ease-in-out infinite; }

/* What it has eaten = what a pop gives back */
.strump-gain {
  position: absolute;
  top: -1.3rem;
  left: 50%;
  padding: 0.05rem 0.45rem;
  font-size: 0.85rem;
  font-weight: 900;
  white-space: nowrap;
  color: #3a2716;
  background: #ffd23f;
  border-radius: 8px;
  transform: translateX(-50%) rotate(calc(var(--turn, 0rad) * -1));   /* stays upright whatever way the sock turns */
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  opacity: 0;                                 /* only shown while the mouse/finger is on the sock */
  pointer-events: none;
}

.strump:hover .strump-gain,
.strump:focus-visible .strump-gain { opacity: 1; }
.strump-gain:empty { display: none; }
.strump.is-hurt .strump-picture { filter: drop-shadow(0 0 6px #ff8a6b) drop-shadow(0 3px 0 rgba(20, 12, 4, 0.55)); }
.strump.is-hit .strump-picture { animation: strump-hit 0.25s ease-out; }

@keyframes strump-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-4px) rotate(3deg); }
}

/* Floating in: a lazy sway from side to side with a little squash */
@keyframes strump-sway {
  0%, 100% { transform: rotate(-9deg) scale(1, 1); }
  50% { transform: rotate(9deg) scale(0.95, 1.04); }
}

@keyframes strump-hit {
  0% { transform: scale(1.25) rotate(-12deg); }
  60% { transform: scale(0.9) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

/* What the socks do to the production (and Lånekläder's time) – one small line under "per sekund" */
.strump-status {
  position: relative;                   /* above the falling potatoes (.rain/.shower are positioned; bug 2026-11-22) */
  margin: 0.3rem 0 0;
  padding: 0.1rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff6e6;
  background: rgba(61, 42, 92, 0.85);
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .strump-picture,
  .strump.is-crawling .strump-picture { animation: none; }
}

/* ---------- The water (instead of Cookie Clicker's milk) and the änder ---------- */
.water {
  --water: #7d99a8;                      /* the tint of the level (vatten.js), set by the page */
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0;                             /* the page sets the height: up to 35 % of the box */
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--water) 55%, transparent),
    color-mix(in srgb, var(--water) 80%, #000 20%));
  border-top: 3px solid color-mix(in srgb, var(--water) 60%, #fff 40%);
  transition: height 1.2s ease-out;
}

/* the surface: two BIG slow sine waves (one SVG tile each, no small detail), drifting the opposite ways */
.water::before,
.water::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 16px;
  margin-bottom: -1px;
  --wave: color-mix(in srgb, var(--water) 55%, transparent);
  animation: water-wave 9s linear infinite;
  /* the wave is a mask (one sine tile), so the colour is simply the water's own */
  background-color: var(--wave);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16V8C25 0 75 0 100 8S175 16 200 8V16z' fill='%23000'/%3E%3C/svg%3E") 0 0 / 200px 100% repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16V8C25 0 75 0 100 8S175 16 200 8V16z' fill='%23000'/%3E%3C/svg%3E") 0 0 / 200px 100% repeat-x;
}

.water::after {
  height: 12px;
  opacity: 0.7;
  animation-duration: 14s;
  animation-direction: reverse;
}

@keyframes water-wave {
  to { -webkit-mask-position-x: 200px; mask-position-x: 200px; }
}

/* The änder sit on the surface: the picture's waterline is ~70 % down (ande.svg: the body ends at y 106 of 128),
   so that much of the duck is above the water's edge – only the head showed before (owner, 2026-10-26) */
.ducks {
  position: absolute;
  left: 0;
  right: 0;
  top: -2.4rem;
  height: 4rem;
}

.duck {
  position: absolute;
  top: 0;
  width: 3.4rem;
  height: 3.4rem;
  animation: duck-bob 2.6s ease-in-out infinite;
}

.duck img {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 70%;
  animation: duck-swim 9s ease-in-out infinite alternate;
}

@keyframes duck-bob {
  50% { transform: translateY(0.25rem); }
}

@keyframes duck-swim {
  from { transform: translateX(-0.8rem) scaleX(1); }
  49% { transform: translateX(0.8rem) scaleX(1); }
  51% { transform: translateX(0.8rem) scaleX(-1); }
  to { transform: translateX(-0.8rem) scaleX(-1); }
}

@media (prefers-reduced-motion: reduce) {
  .water, .water::before, .water::after, .duck, .duck img { animation: none; transition: none; }
}

/* ---------- Ner i jorden (ner-i-jorden.js, rootmap.js; docs/potatoclicker-design.md section 7) ----------
   Under ground the colours go WARMER, not darker: honey, amber, rose. Magical, soft, dreamy. */

.clicker {
  position: relative;                    /* the preview, the sweep and Rotrummet cover the whole game */
  --soil-light: #ffe2b8;
  --soil-gold: #ffc96b;
  --soil-rose: #ff9fb3;
}

/* The sprout hole under the potato: a soft glowing opening with the mylla a descent would give */
.descend-hole {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  width: 100%;
  margin: 0 0 0.8rem;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 800;
  color: var(--soil-light);
  background: radial-gradient(ellipse at 50% 30%, #6a3d1e, #2a170c 70%);
  border: 2px solid #5a3417;
  border-radius: 999px / 70%;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6), 0 0 18px rgba(255, 190, 110, 0.35);
  cursor: pointer;
}
.descend-hole[hidden] { display: none; }

/* The meter along the hole's bottom edge: fills up towards the next mylla and starts over (Cookie Clicker's gauge under
   the Legacy button). ner-i-jorden.js sets --share 0-1 five times a second; the bar glides between, and a shimmer runs
   through it. */
.descend-meter {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.25rem;
  height: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  pointer-events: none;
}

.descend-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #b9782f, var(--soil-gold), #fff1c4, var(--soil-gold), #b9782f) 0 0 / 200% 100%;
  box-shadow: 0 0 6px rgba(255, 190, 90, 0.9);
  transform: translateX(calc((var(--share, 0) - 1) * 100%));
  transition: transform 0.25s linear;
  animation: meter-shimmer 2.5s linear infinite;
}

.descend-fill.is-reset { transition: none; }   /* a new mylla: back to empty at once */

@keyframes meter-shimmer {
  to { background-position: -200% 0; }
}

/* A new mylla to dig down for: the number pops */
.descend-count.is-new { animation: count-pop 0.5s ease-out; }

@keyframes count-pop {
  40% { transform: scale(1.35); text-shadow: 0 0 14px rgba(255, 220, 140, 1); }
}
.descend-glow {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: radial-gradient(closest-side, rgba(255, 200, 120, 0.35), transparent);
  animation: hole-breathe 3.2s ease-in-out infinite;
  pointer-events: none;
}
.descend-sprout,
.descend-name { position: relative; }
.descend-name { margin-right: auto; }
.descend-count { position: relative; color: var(--soil-gold); text-shadow: 0 0 8px rgba(255, 190, 90, 0.8); }
.descend-word { position: relative; font-size: 0.85em; opacity: 0.85; }
.descend-hole:hover,
.descend-hole:focus-visible { box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6), 0 0 28px rgba(255, 200, 130, 0.65); }
@keyframes hole-breathe {
  0%, 100% { opacity: 0.45; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* The preview: the surface (what stays, glowing) over a cross-section of soil (what goes, sinking and greying) */
.descend-preview {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(#2c4a2a 0 22%, #5a3a1c 22% 23%, #46281a 30%, #33161f 100%);
  color: var(--soil-light);
}
.descend-preview[hidden] { display: none; }
.preview-surface {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.4rem;
  padding: 1.1rem 1rem 0.8rem;
}
.preview-stays,
.preview-goes {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.15rem;
}
.preview-stays {
  color: #fff6dc;
  text-shadow: 0 0 10px rgba(255, 220, 140, 0.9);
}
.descend-preview.is-open .preview-stays { animation: stays-lift 1.4s ease-out both; }
.preview-icon { font-size: 1.5em; }
.preview-soil {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 0.55rem;
  padding: 1.2rem 1rem 1.2rem;
}
.preview-goes { color: var(--soil-light); }
.descend-preview.is-open .preview-goes {
  animation: goes-sink 1.6s cubic-bezier(0.5, 0, 0.6, 1) calc(0.35s + var(--sink) * 0.3s) both;
}
@keyframes goes-sink {
  from { transform: translateY(-1.5rem); opacity: 1; filter: none; }
  to { transform: translateY(0.4rem); opacity: 0.38; filter: grayscale(1) blur(0.4px); }
}
@keyframes stays-lift {
  from { transform: translateY(0.8rem); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.preview-mylla {
  margin: 0.6rem 0 0.2rem;
  text-align: center;
  font-size: 1.2rem;
}
.preview-mylla strong {
  display: block;
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  line-height: 1;
  color: var(--soil-gold);
  text-shadow: -2px 0 rgba(255, 90, 140, 0.55), 2px 0 rgba(90, 200, 255, 0.5), 0 0 22px rgba(255, 190, 90, 0.9);
}
.descend-preview.is-open .preview-mylla { animation: stays-lift 1.2s ease-out 1.2s both; }
.preview-mylla small { display: block; margin-top: 0.2rem; font-size: 0.9rem; opacity: 0.85; }
.preview-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}
.dig-down {
  position: relative;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background: linear-gradient(#a8692f, #6b3a18);
}
.dig-fill {
  position: absolute;
  inset: auto 0 0 0;
  height: calc(var(--dug, 0) * 100%);
  background: rgba(255, 210, 140, 0.35);
  pointer-events: none;
}
.dig-spade { display: inline-block; }
.dig-down.is-holding .dig-spade { animation: dig 0.35s steps(2) infinite; }
.dig-down.is-wiggle .dig-spade { animation: dig 0.18s ease-in-out 2; }
@keyframes dig {
  0%, 100% { transform: rotate(0) translateY(0); }
  50% { transform: rotate(-22deg) translateY(3px); }
}
.preview-small { margin: 0; font-size: 0.9rem; opacity: 0.85; }

/* The sweep down (and up): a canvas over the whole game */
.descent-sweep {
  position: absolute;
  inset: 0;
  z-index: 7;
  border-radius: 12px;
  overflow: hidden;
  background: #3a1c16;
}
.descent-sweep[hidden] { display: none; }
.descent-sweep canvas { width: 100%; height: 100%; display: block; }

/* Rotrummet: the root map fills the game; the mylla and "Gro igen" float at the top, a root's card at the bottom */
.rotrummet {
  position: absolute;
  inset: 0;
  z-index: 6;
  min-height: 24rem;
  border-radius: 12px;
  overflow: hidden;
  background: #3a2414;
  color: var(--soil-light);
}
.rotrummet[hidden] { display: none; }
.root-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
.room-top {
  position: absolute;
  inset: 0.7rem 0.8rem auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  pointer-events: none;
}
.room-top > * { pointer-events: auto; }
.room-mylla {
  margin: 0;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(40, 18, 14, 0.55);
  font-size: 1.1rem;
}
.room-mylla strong {
  font-size: 1.6rem;
  color: var(--soil-gold);
  text-shadow: -1.5px 0 rgba(255, 90, 140, 0.5), 1.5px 0 rgba(90, 200, 255, 0.45), 0 0 14px rgba(255, 190, 90, 0.8);
}
.room-mylla small { opacity: 0.8; }
.sprout-again { background: linear-gradient(#8fb85a, #4f7a2a); }
.root-card {
  position: absolute;                   /* placed beside the tapped root by ner-i-jorden.js placeCard */
  left: 0.5rem;
  top: 4rem;
  z-index: 2;
  width: min(22rem, calc(100% - 1rem));
  max-height: calc(100% - 1rem);
  overflow: auto;
  box-sizing: border-box;
  padding: 0.9rem 1.1rem 1rem;
  border-radius: 16px;
  background: linear-gradient(rgba(70, 36, 24, 0.92), rgba(48, 22, 30, 0.94));
  border: 1px solid rgba(255, 210, 160, 0.35);
  box-shadow: 0 0 30px rgba(255, 170, 110, 0.25), 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: stays-lift 0.35s ease-out both;
}
.root-card[hidden] { display: none; }
.root-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  color: #fff4dc;
  text-shadow: -1px 0 rgba(255, 90, 140, 0.45), 1px 0 rgba(90, 200, 255, 0.4);
}
.root-layer { margin: 0 2rem 0 0; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
.root-text { margin: 0 0 0.4rem; }
.root-text b { color: var(--soil-gold); }
.root-quote {
  margin: 0 0 0.6rem;
  text-align: right;
  font-style: italic;
  font-family: Georgia, "Tinos", serif;
  opacity: 0.85;
}
.root-buy { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin: 0; }
.root-price strong { font-size: 1.3rem; color: var(--soil-gold); }
.root-card.is-grown .root-price { display: none; }
.root-grown { font-weight: 800; color: var(--soil-gold); }
.root-grown[hidden] { display: none; }
.root-slot[hidden] { display: none; }
.root-slot-title { margin: 0.5rem 0 0.3rem; font-weight: 800; }
.root-slot-list { display: flex; flex-direction: column; gap: 0.25rem; max-height: 9rem; overflow-y: auto; margin-bottom: 0.5rem; }
.slot-choice { min-height: 44px; text-align: left; padding: 0.3rem 0.6rem; border: 2px solid var(--wood); border-radius: 0.4rem; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.slot-choice.is-chosen { background: var(--soil-gold); color: #2b1a08; font-weight: 800; }
.root-card-close {
  position: absolute;
  z-index: 1;                           /* above the card's own text */
  width: 2.75rem;
  height: 2.75rem;                      /* a finger-sized target */
  top: 0;
  right: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
}
#grow-root:disabled { filter: grayscale(0.8); opacity: 0.6; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .descend-glow,
  .descend-fill,
  .descend-count.is-new,
  .descend-preview.is-open .preview-goes,
  .descend-preview.is-open .preview-stays,
  .descend-preview.is-open .preview-mylla { animation: none; }
}

/* Narrow or low screens (a phone held either way): the game is taller than the screen, so the preview, the sweep and
   Rotrummet cover the SCREEN, not the page */
@media (max-width: 759px), (max-height: 520px) {
  .descend-preview,
  .descent-sweep,
  .rotrummet {
    position: fixed;
    z-index: 1001;
    border-radius: 0;
  }
}

/* Rotrummet's zoom buttons, bottom right (the root card lies beside the root it is about) */
.map-zoom {
  position: absolute;
  right: 0.8rem;
  bottom: 0.8rem;
  display: grid;
  gap: 0.4rem;
}
.map-zoom button {
  width: 2.75rem;
  height: 2.75rem;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--soil-light);
  background: rgba(40, 18, 14, 0.6);
  border: 1px solid rgba(255, 210, 160, 0.35);
  border-radius: 50%;
  cursor: pointer;
}
.map-zoom button:hover { background: rgba(80, 40, 24, 0.75); }
