/* Senast uppdaterad: 2026-07-30 20:04 | av: Codex & KlⒶssⓔ */
:root {
  color-scheme: light;
  --ink: #261d18;
  --paper: #fff9e9;
  --cream: #f5e5bd;
  --grass: #78ad56;
  --grass-dark: #315f37;
  --orange: #e9653f;
  --orange-dark: #a73829;
  --yellow: #ffd55c;
  --blue: #4ba9cd;
  --shadow: 0 18px 50px rgba(27, 48, 24, .25);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #203c27;
  overscroll-behavior: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 229, 126, .2), transparent 25rem),
    linear-gradient(145deg, #294b30, #162b1c);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mobile-only {
  display: none !important;
}

html[data-device="mobile"] .desktop-only {
  display: none !important;
}

html[data-device="mobile"] .mobile-only {
  display: revert !important;
}

html[data-device="desktop"] .mobile-controls {
  display: none !important;
}

html[data-device="mobile"],
html[data-device="mobile"] body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html[data-device="mobile"] body {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
}

html[data-device="mobile"] .game-shell {
  display: block;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  padding:
    max(3px, env(safe-area-inset-top))
    max(3px, env(safe-area-inset-right))
    max(3px, env(safe-area-inset-bottom))
    max(3px, env(safe-area-inset-left));
}

html[data-device="mobile"] .game-stage {
  width: 100%;
  height: 100%;
  border-width: 3px;
  border-radius: 16px;
}

html[data-device="mobile"] .text-instructions {
  display: none;
}

.game-shell {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: .75rem;
  width: min(100%, 1500px);
  margin: auto;
  padding: clamp(.35rem, 2vw, 1.5rem);
}

.game-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: clamp(3px, .6vw, 8px) solid rgba(255, 249, 233, .9);
  border-radius: clamp(14px, 2.2vw, 32px);
  background: #5d9447;
  box-shadow: var(--shadow);
  isolation: isolate;
  touch-action: none;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #78ad56;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 4rem);
  background: rgba(28, 45, 28, .74);
  backdrop-filter: blur(7px);
}

.screen.is-active {
  display: flex;
}

.loading-screen {
  flex-direction: column;
  color: #fff;
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 850;
}

.loading-paw {
  font-size: clamp(3rem, 9vw, 7rem);
  animation: loading-bounce 800ms ease-in-out infinite alternate;
}

.menu-screen {
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
  background: #1c3d27;
  backdrop-filter: none;
}

.menu-start-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.menu-copy {
  position: absolute;
  right: clamp(.7rem, 2vw, 1.6rem);
  bottom: clamp(.7rem, 2vw, 1.6rem);
  left: clamp(.7rem, 2vw, 1.6rem);
  z-index: 2;
  display: flex;
  width: auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(.65rem, 1.4vw, 1rem);
  border: 2px solid rgba(255, 255, 255, .68);
  border-radius: clamp(16px, 2vw, 24px);
  color: #fff;
  background: rgba(30, 24, 18, .78);
  box-shadow: 0 12px 32px rgba(10, 20, 10, .36);
  backdrop-filter: blur(9px);
}

.kicker {
  margin: 0 0 .35rem;
  color: var(--orange-dark);
  font-size: clamp(.68rem, 1.2vw, .95rem);
  font-weight: 950;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1,
h2,
p {
  text-wrap: balance;
}

h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(2.3rem, 6.4vw, 6.8rem);
  line-height: .84;
  letter-spacing: -.075em;
}

h2 {
  margin: 0 0 .7rem;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: .95;
  letter-spacing: -.055em;
}

.subtitle {
  margin: .4rem 0;
  color: var(--orange);
  font-size: clamp(1.3rem, 3.3vw, 3rem);
  font-weight: 950;
  letter-spacing: -.04em;
}

.menu-intro {
  max-width: 610px;
  margin: 0;
  font-size: clamp(.82rem, 1.5vw, 1.18rem);
  font-weight: 650;
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
  gap: .65rem;
}

.button,
.icon-button,
.control-button,
.ability-button {
  min-width: 44px;
  min-height: 44px;
  border: 2px solid rgba(38, 29, 24, .25);
  color: var(--ink);
  background: rgba(255, 249, 233, .96);
  box-shadow: 0 6px 0 rgba(62, 45, 33, .22);
  cursor: pointer;
  font-weight: 900;
}

.button {
  padding: .65rem 1rem;
  border-radius: 999px;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
}

.button:active,
.control-button.is-pressed,
.ability-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(62, 45, 33, .22);
}

.button-primary {
  border-color: var(--orange-dark);
  color: #fff;
  background: var(--orange);
}

.instructions-screen,
.pause-screen,
.result-screen {
  background: rgba(28, 45, 28, .86);
}

.instructions-card,
.result-card,
.dialog-card {
  width: min(100%, 980px);
  max-height: 100%;
  overflow: auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  border: 3px solid rgba(255, 255, 255, .72);
  border-radius: clamp(18px, 3vw, 34px);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.instructions-card,
.result-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, .8fr);
  gap: 1.5rem;
  align-items: center;
}

.instructions-card ul {
  display: grid;
  gap: .4rem;
  margin: .5rem 0 1.1rem;
  padding-left: 1.25rem;
}

.instructions-card img,
.result-card img {
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  filter: drop-shadow(0 14px 12px rgba(45, 35, 22, .2));
}

.dialog-card {
  width: min(92%, 460px);
  text-align: center;
}

.stacked-actions {
  display: grid;
  gap: .7rem;
}

.result-message {
  margin: .3rem 0 1rem;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 750;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  margin: 0 0 1rem;
}

.result-stats div {
  padding: .65rem;
  border-radius: 14px;
  background: var(--cream);
}

.result-stats dt {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-stats dd {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 950;
}

.hud {
  position: absolute;
  top: clamp(.35rem, 1vw, .8rem);
  left: 50%;
  z-index: 10;
  display: none;
  width: calc(100% - clamp(.7rem, 2vw, 1.6rem));
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .35rem .55rem;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 16px;
  background: rgba(255, 249, 233, .9);
  box-shadow: 0 8px 24px rgba(27, 48, 24, .2);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.hud.is-active {
  display: flex;
}

.hud-cluster,
.snack-status {
  display: flex;
  align-items: center;
  gap: clamp(.35rem, 1.2vw, 1rem);
  font-size: clamp(.7rem, 1.5vw, 1rem);
  white-space: nowrap;
}

.hearts {
  letter-spacing: -.16em;
}

.level-status {
  color: var(--orange-dark);
  font-weight: 950;
}

.snack-status span {
  display: grid;
  width: clamp(27px, 3vw, 38px);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: clamp(.85rem, 1.8vw, 1.3rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.snack-status span.is-collected {
  opacity: .28;
  transform: scale(.8);
  filter: grayscale(1);
}

.cooldown {
  color: var(--grass-dark);
  font-weight: 900;
}

.cooldown.is-cooling {
  color: var(--orange-dark);
}

.icon-button {
  display: grid;
  width: 44px;
  padding: 0;
  place-items: center;
  border-radius: 13px;
}

.mobile-controls {
  position: absolute;
  right: clamp(.55rem, 2.2vw, 1.4rem);
  bottom: clamp(.3rem, 1.2vw, .9rem);
  z-index: 12;
  display: none;
  align-items: end;
  pointer-events: none;
}

.mobile-controls.is-active {
  display: flex;
}

.ability-button {
  display: grid;
  width: clamp(72px, 13vw, 104px);
  aspect-ratio: 1;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(233, 101, 63, .92);
  pointer-events: auto;
}

.touch-stick {
  position: absolute;
  z-index: 15;
  display: none;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50%;
  background: rgba(25, 57, 31, .35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .2);
  pointer-events: none;
}

.touch-stick.is-active {
  display: grid;
}

.touch-stick-knob {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: rgba(233, 101, 63, .92);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}

.ability-button span {
  font-size: clamp(1rem, 2.6vw, 1.7rem);
}

.ability-button small {
  font-size: clamp(.55rem, 1vw, .72rem);
}

.ability-button.is-cooling {
  color: rgba(255, 255, 255, .72);
  background: rgba(65, 58, 52, .82);
}

.game-announcement {
  position: absolute;
  top: 18%;
  left: 50%;
  z-index: 9;
  max-width: 80%;
  margin: 0;
  padding: .45rem .8rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(38, 29, 24, .82);
  font-size: clamp(.75rem, 1.8vw, 1.15rem);
  font-weight: 950;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.game-announcement.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.orientation-hint {
  position: absolute;
  left: 50%;
  z-index: 13;
  display: none;
  margin: 0;
  padding: .45rem .7rem;
  border-radius: 12px;
  color: #fff;
  background: rgba(0, 0, 0, .28);
  font-size: .75rem;
  font-weight: 750;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.orientation-hint.is-visible {
  display: block;
}

.text-instructions {
  padding: .7rem 1rem;
  border-radius: 14px;
  color: rgba(255, 255, 255, .88);
  background: rgba(0, 0, 0, .2);
  font-size: .78rem;
}

.text-instructions h2 {
  margin: 0;
  color: #fff;
  font-size: .9rem;
  letter-spacing: 0;
}

.text-instructions p {
  margin: .2rem 0 0;
}

@keyframes loading-bounce {
  to { transform: translateY(-12px) rotate(-8deg); }
}

@media (hover: none), (pointer: coarse) {
  html[data-device="mobile"] .mobile-controls.is-active {
    display: flex;
  }
}

@media (orientation: portrait) {
  html[data-device="mobile"] .game-stage {
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
  }

  html[data-device="mobile"] #game-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    min-width: 0;
    height: auto;
    transform: translate(-50%, -50%);
  }

  html[data-device="mobile"] .menu-screen {
    align-items: start;
    padding: 0;
    background: #1c3d27;
  }

  html[data-device="mobile"] .menu-start-image {
    top: 0;
    bottom: auto;
    height: 68%;
    object-position: center center;
  }

  html[data-device="mobile"] .menu-copy {
    right: .55rem;
    bottom: .55rem;
    left: .55rem;
    display: block;
    width: auto;
    padding: .8rem;
  }

  html[data-device="mobile"] .menu-intro {
    margin: 0 0 .7rem;
    font-size: .8rem;
  }

  html[data-device="mobile"] .menu-actions {
    gap: .4rem;
  }

  html[data-device="mobile"] .menu-actions .button {
    padding: .55rem .72rem;
    font-size: .8rem;
  }

  html[data-device="mobile"] .screen {
    padding: .65rem;
  }

  html[data-device="mobile"] .instructions-card,
  html[data-device="mobile"] .result-card {
    display: block;
    max-height: calc(100dvh - 1.3rem);
    padding: 1rem;
    font-size: .8rem;
  }

  html[data-device="mobile"] .instructions-card img,
  html[data-device="mobile"] .result-card img {
    display: none;
  }

  html[data-device="mobile"] .hud {
    top: max(.35rem, env(safe-area-inset-top));
    display: none;
    grid-template-columns: minmax(0, 1fr) auto;
    width: calc(100% - 1rem);
    min-height: 0;
    align-items: center;
    gap: .3rem;
    padding: .35rem;
    border-radius: 14px;
  }

  html[data-device="mobile"] .hud.is-active {
    display: grid;
  }

  html[data-device="mobile"] .hud-cluster {
    gap: .42rem;
    font-size: clamp(.68rem, 3vw, .8rem);
  }

  html[data-device="mobile"] .level-name {
    display: none;
  }

  html[data-device="mobile"] .hud-right {
    justify-self: end;
  }

  html[data-device="mobile"] .snack-status {
    grid-column: 1 / -1;
    width: auto;
    justify-content: center;
    gap: .35rem;
  }

  html[data-device="mobile"] .snack-status span {
    width: 30px;
  }

  html[data-device="mobile"] .cooldown {
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html[data-device="mobile"] .mobile-controls {
    right: max(.7rem, env(safe-area-inset-right));
    bottom: max(.55rem, env(safe-area-inset-bottom));
  }

  html[data-device="mobile"] .ability-button {
    width: clamp(88px, 25vw, 100px);
  }

  html[data-device="mobile"] .orientation-hint {
    bottom: calc(max(.55rem, env(safe-area-inset-bottom)) + 6.8rem);
    max-width: calc(100% - 2rem);
    padding: .4rem .65rem;
    overflow: hidden;
    font-size: .7rem;
    text-overflow: ellipsis;
  }

  html[data-device="mobile"] .game-announcement {
    top: 27%;
  }
}

@media (orientation: landscape) {
  html[data-device="mobile"] .game-shell {
    width: min(100vw, calc(100dvh * 16 / 9));
    margin: auto;
  }

  html[data-device="mobile"] .game-stage {
    aspect-ratio: 16 / 9;
  }

  html[data-device="mobile"] .ability-button {
    width: 76px;
  }

  html[data-device="mobile"] .orientation-hint {
    display: none;
  }
}

@media (max-height: 620px) {
  .game-shell {
    width: min(100%, calc(100vh * 16 / 9));
    padding: .2rem;
  }

  .game-stage {
    max-height: calc(100vh - .4rem);
  }

  .text-instructions,
  .orientation-hint {
    display: none;
  }

  .menu-screen {
    padding: 0;
  }

  .menu-copy {
    right: .45rem;
    bottom: .45rem;
    left: .45rem;
    gap: .55rem;
    padding: .5rem .65rem;
  }

  .menu-intro {
    margin: 0;
    font-size: .72rem;
  }

  .menu-actions {
    gap: .35rem;
  }

  .menu-actions .button {
    min-height: 40px;
    padding: .42rem .65rem;
    font-size: .72rem;
  }

  .instructions-card,
  .result-card,
  .dialog-card {
    padding: .8rem 1rem;
  }

  .instructions-card ul {
    gap: .1rem;
    margin: .2rem 0 .5rem;
    font-size: .76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
