@font-face {
  font-family: "Archivo Black";
  src: url("/wp-content/themes/czesc-gizycko/assets/fonts/archivo-black-latin-ext.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113;
}

@font-face {
  font-family: "Archivo Black";
  src: url("/wp-content/themes/czesc-gizycko/assets/fonts/archivo-black-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Montserrat";
  src: url("/wp-content/themes/czesc-gizycko/assets/fonts/montserrat-latin-ext.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113;
}

@font-face {
  font-family: "Montserrat";
  src: url("/wp-content/themes/czesc-gizycko/assets/fonts/montserrat-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --blue: #0849a2;
  --sky: #d6e9fe;
  --ice: #f7fbff;
  --white: #fff;
  --ink: #111;
  --muted: #536674;
  --line: rgba(8, 73, 162, 0.2);
  --orange: #ee7b38;
  --forest: #173b31;
  --forest-soft: #315c49;
  --sand: #e4a94e;
  --berry: #3156a4;
  --display: "Archivo Black", "Arial Black", sans-serif;
  --body: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #fff;
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 300;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: #fff;
  background: var(--blue);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.mobile-orientation {
  display: none;
}

.portal-header {
  border-bottom: 1px solid rgba(8, 73, 162, 0.12);
  background: #fff;
}

.portal-header__masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 2rem), 1360px);
  min-height: 92px;
  margin: 0 auto;
}

.portal-header__brand {
  display: inline-flex;
  align-items: center;
}

.portal-header__brand img {
  display: block;
  width: 92px;
  height: auto;
}

.portal-header__back {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  text-decoration: none;
  text-transform: uppercase;
}

.portal-header__back span {
  font-size: 1.15rem;
  transition: transform 140ms ease;
}

.portal-header__back:hover span,
.portal-header__back:focus-visible span {
  transform: translateX(-4px);
}

.game-page {
  width: min(calc(100% - 2rem), 1360px);
  margin: 0 auto;
  padding: clamp(2rem, 3.5vw, 3.25rem) 0 clamp(4rem, 7vw, 7rem);
}

.game-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.42fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.game-heading h1,
.game-overlay h2,
.leaderboard__header h2,
.game-manual h2 {
  margin: 0;
  color: var(--blue);
  font-family: var(--display);
  font-weight: 400;
}

.game-heading h1 {
  font-size: clamp(2.75rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.game-heading__lead {
  max-width: 760px;
  margin: 0.85rem 0 0;
  color: rgba(17, 17, 17, 0.72);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.68;
}

.game-heading__facts {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
  align-items: flex-start;
  max-width: 340px;
  margin: 0 0 0.2rem;
  color: var(--blue);
  font-size: clamp(1rem, 1.3vw, 1.18rem);
  font-weight: 900;
  line-height: 1.18;
  text-transform: uppercase;
}

.game-heading__facts span {
  display: block;
  transform-origin: left center;
}

.game-heading__facts span:nth-child(1) { transform: rotate(-1deg); }
.game-heading__facts span:nth-child(2) { transform: rotate(0.8deg); }
.game-heading__facts span:nth-child(3) { transform: rotate(-0.45deg); }

.game-shell {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--blue);
  background: var(--blue);
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr)) 68px;
  color: #fff;
  background: var(--blue);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.hud-item {
  min-height: 68px;
  padding: 0.72rem clamp(0.75rem, 1.7vw, 1.45rem);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.hud-item__label {
  display: block;
  margin-bottom: 0.15rem;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-item strong {
  display: block;
  overflow: hidden;
  font-family: var(--display);
  font-size: clamp(0.93rem, 1.35vw, 1.2rem);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-button {
  width: 68px;
  min-height: 68px;
  color: #fff;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.35rem;
}

.sound-button:hover,
.sound-button:focus-visible {
  color: var(--blue);
  background: var(--sky);
  outline: 0;
}

.sound-button[aria-pressed="false"] {
  color: rgba(255, 255, 255, 0.42);
  text-decoration: line-through;
}

.game-stage {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: var(--forest-soft);
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
  cursor: pointer;
  touch-action: none;
}

#gameCanvas:focus-visible {
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 7px var(--blue);
}

.game-overlay {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: clamp(1rem, 5vw, 4.25rem);
  width: min(520px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: clamp(1.2rem, 2.5vw, 2rem);
  overflow-y: auto;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.975);
  box-shadow: 0 12px 30px rgba(8, 73, 162, 0.16);
  transform: translateY(-50%);
  transition: opacity 170ms ease, visibility 170ms ease, transform 170ms ease;
}

.game-overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-50% + 8px));
}

.game-overlay__eyebrow {
  margin: 0 0 0.5rem;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
}

.game-overlay h2,
.leaderboard__header h2,
.game-manual h2 {
  font-size: clamp(2rem, 3.8vw, 3.6rem);
  line-height: 1.03;
  letter-spacing: -0.025em;
}

.game-overlay h2 {
  font-size: clamp(2rem, 3.1vw, 2.8rem);
}

.game-overlay > p:not(.game-overlay__eyebrow):not(.game-overlay__hint),
.leaderboard__header p {
  color: rgba(17, 17, 17, 0.72);
  font-size: 0.9rem;
  line-height: 1.58;
}

.game-overlay__score {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.game-overlay__score span {
  padding: 0.8rem 0.7rem;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
}

.game-overlay__score span + span {
  border-left: 1px solid var(--line);
}

.game-overlay__score strong {
  display: block;
  margin-top: 0.28rem;
  color: var(--blue);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 400;
  white-space: nowrap;
}

.primary-button,
.score-form button {
  min-height: 46px;
  padding: 0.7rem 1.25rem;
  color: #fff;
  background-color: var(--blue);
  background-image: linear-gradient(90deg, #fff 0 50%, var(--blue) 50% 100%);
  background-position: 100% 0;
  background-size: 220% 100%;
  border: 1px solid var(--blue);
  border-radius: 0;
  box-shadow: 0 10px 22px rgba(8, 73, 162, 0.2);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 850;
  transition: color 170ms ease, background-position 200ms ease, transform 150ms ease;
}

.primary-button:hover,
.primary-button:focus-visible,
.score-form button:hover,
.score-form button:focus-visible {
  color: var(--blue);
  background-position: 0 0;
  outline: 0;
  transform: translateY(1px);
}

.primary-button:disabled,
.score-form button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.game-overlay__hint {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.score-form {
  margin: 1rem 0;
}

.score-form > label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.score-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.score-form input {
  min-width: 0;
  min-height: 46px;
  padding: 0.68rem 0.8rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(8, 73, 162, 0.35);
  border-right: 0;
  border-radius: 0;
  outline: 0;
}

.score-form input:focus {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.score-form > p {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.45;
}

.score-form__status.is-error { color: #a12d20; }
.score-form__status.is-success { color: #16735b; }

.game-message {
  position: absolute;
  z-index: 6;
  top: 1rem;
  left: 50%;
  padding: 0.55rem 0.8rem;
  color: #fff;
  background: rgba(8, 73, 162, 0.9);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity 140ms ease, transform 140ms ease;
}

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

.jump-hint {
  display: none;
}

.leaderboard {
  margin-top: clamp(4rem, 8vw, 7rem);
}

.leaderboard__header {
  display: grid;
  grid-template-columns: minmax(0, 820px) auto;
  gap: 1.5rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}

.leaderboard__header p {
  max-width: 760px;
  margin: 0.75rem 0 0;
  font-size: clamp(0.95rem, 1.2vw, 1.08rem);
  line-height: 1.68;
}

.leaderboard__mark {
  padding-bottom: 0.3rem;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 900;
}

.leaderboard__table-wrap {
  overflow-x: auto;
  border-top: 3px solid var(--blue);
}

.leaderboard table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
}

.leaderboard th,
.leaderboard td {
  padding: 1.05rem clamp(0.75rem, 2vw, 1.45rem);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.leaderboard th {
  color: var(--muted);
  background: rgba(214, 233, 254, 0.42);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.leaderboard td {
  color: #173754;
  font-size: 0.84rem;
  font-weight: 550;
}

.leaderboard tr.is-podium td {
  background: rgba(214, 233, 254, 0.26);
}

.leaderboard__place,
.leaderboard__captain,
.leaderboard__score {
  color: var(--blue) !important;
  font-weight: 850 !important;
}

.leaderboard__empty,
.leaderboard__error {
  margin: 0;
  padding: 1.25rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.leaderboard__error {
  color: #a12d20;
}

.leaderboard.has-new-score {
  scroll-margin-top: 1rem;
}

.game-manual {
  margin-top: clamp(4rem, 7vw, 6rem);
}

.game-manual__rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 3rem);
  margin-top: 1.8rem;
}

.game-manual__rules p {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  margin: 0;
  color: rgba(17, 17, 17, 0.72);
  font-size: clamp(0.92rem, 1.1vw, 1.02rem);
  line-height: 1.62;
}

.game-manual__rules b {
  color: var(--blue);
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 400;
}

.game-manual__keys {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

kbd {
  display: inline-block;
  min-width: 1.8rem;
  margin: 0 0.15rem;
  padding: 0.28rem 0.42rem;
  color: var(--blue);
  background: var(--sky);
  border: 1px solid rgba(8, 73, 162, 0.28);
  font-family: var(--body);
  font-size: 0.65rem;
  font-weight: 850;
  text-align: center;
}

.game-footer {
  padding: 1.3rem 1rem;
  color: rgba(255, 255, 255, 0.74);
  background: var(--blue);
  font-size: 0.68rem;
  text-align: center;
}

.game-footer p {
  margin: 0;
}

.game-footer a {
  color: #fff;
  font-weight: 800;
}

@media (max-width: 760px) {
  .portal-header__masthead,
  .game-page {
    width: min(calc(100% - 1.25rem), 1360px);
  }

  .portal-header__masthead {
    min-height: 76px;
  }

  .portal-header__brand img {
    width: 76px;
  }

  .portal-header__back {
    font-size: 0.65rem;
  }

  .game-heading {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .game-heading h1 {
    font-size: 32px;
  }

  .game-heading__lead,
  .leaderboard__header p,
  .game-manual__rules p {
    font-size: 0.9rem;
  }

  .game-heading__facts {
    font-size: 0.72rem;
  }

  .leaderboard__header {
    grid-template-columns: 1fr auto;
  }

  .leaderboard__header h2,
  .game-manual h2 {
    font-size: 24px;
  }

  .game-manual__rules {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .leaderboard th:nth-child(5),
  .leaderboard td:nth-child(5) {
    display: none;
  }
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--blue);
  }

  .skip-link,
  .portal-header,
  .game-heading,
  .leaderboard,
  .game-manual,
  .game-footer {
    display: none !important;
  }

  .game-page {
    position: fixed;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100dvw;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  .game-shell {
    display: grid;
    grid-template-rows: 42px auto;
    width: 100dvw;
    height: auto;
    border: 0;
    box-shadow: none;
    filter: grayscale(0.92) saturate(0.3) brightness(0.9);
    pointer-events: none;
  }

  .game-hud {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 40px;
    height: 42px;
    min-height: 0;
    overflow: hidden;
  }

  .hud-item,
  .sound-button {
    height: 42px;
    min-height: 0;
  }

  .hud-item {
    padding: 0.28rem 0.35rem;
  }

  .hud-item__label {
    margin-bottom: 0.02rem;
    font-size: 0.38rem;
  }

  .hud-item strong {
    font-size: clamp(0.5rem, 2.7vw, 0.7rem);
  }

  .sound-button {
    width: 40px;
    font-size: 0.85rem;
  }

  .game-stage {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 2 / 1;
  }

  #gameCanvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 1;
  }

  .game-overlay,
  .game-message,
  .jump-hint {
    display: none !important;
  }

  .mobile-orientation {
    position: fixed;
    z-index: 200;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #fff;
    text-align: center;
    pointer-events: auto;
  }

  .mobile-orientation strong {
    max-width: 260px;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(8, 73, 162, 0.9);
    box-shadow: 0 8px 22px rgba(8, 73, 162, 0.22);
    font-size: clamp(0.78rem, 3.5vw, 0.95rem);
    font-weight: 850;
  }
}

/* Authoritative catcher layout: keep this after every legacy forest rule. */
.game-overlay--forest,
.game-overlay--forest.is-result {
  left: 50%;
  display: block;
  grid-template-columns: none;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
  transform: translate(-50%, -50%);
}

.game-overlay--forest.is-hidden {
  transform: translate(-50%, calc(-50% + 8px));
}

.game-overlay__copy,
.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--forest);
  }

  body > :not(.mobile-orientation) {
    display: none !important;
  }

  .mobile-orientation {
    position: fixed;
    z-index: 300;
    inset: 0;
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #fff;
    background: var(--forest);
    text-align: center;
  }

  .mobile-orientation__phone {
    display: block;
    width: 58px;
    height: 34px;
    border: 3px solid #f2c25d;
    box-shadow: inset 0 0 0 2px var(--forest);
  }

  .mobile-orientation strong {
    max-width: 280px;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 900;
  }

  .mobile-orientation small {
    max-width: 270px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.45;
  }
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-orientation {
    display: none !important;
  }

  .game-stage {
    background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-v2.jpg");
    background-position: center;
    background-size: cover;
  }

  #gameCanvas {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    left: 50%;
    display: block !important;
    width: min(540px, calc(100vw - 1rem));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.7rem 0.9rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.42rem 0 0.55rem;
    font-size: 0.68rem;
    line-height: 1.38;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.15rem;
    font-size: 0.52rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  }

  .game-overlay__hint,
  .score-form > p {
    display: none;
  }

  .game-overlay__score,
  .score-form {
    margin: 0.45rem 0;
  }

  .game-overlay__score span {
    padding: 0.38rem 0.3rem;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 36px;
    padding-block: 0.4rem;
  }

  .catch-hint {
    right: calc(0.6rem + env(safe-area-inset-right));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: #2ca6c8;
  }

  .skip-link,
  .mobile-orientation,
  .portal-header,
  .game-heading,
  .leaderboard,
  .game-manual,
  .game-footer {
    display: none !important;
  }

  .game-page {
    position: fixed;
    inset: 0;
    width: 100dvw;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  .game-shell {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: 46px minmax(0, 1fr);
    width: 100dvw;
    height: 100dvh;
    border: 0;
  }

  .game-hud {
    grid-template-columns: repeat(4, minmax(64px, 1fr)) 44px;
    height: 46px;
    min-height: 0;
    overflow: hidden;
  }

  .hud-item,
  .sound-button {
    height: 46px;
    min-height: 0;
  }

  .hud-item {
    padding: 0.34rem 0.6rem;
  }

  .hud-item__label {
    margin-bottom: 0.04rem;
    font-size: 0.43rem;
    letter-spacing: 0.04em;
  }

  .hud-item strong {
    font-size: clamp(0.62rem, 1.9vw, 0.82rem);
  }

  .sound-button {
    width: 44px;
    font-size: 1rem;
  }

  .game-stage {
    display: flex;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    background: #2ca6c8;
  }

  #gameCanvas {
    width: auto !important;
    max-width: 100%;
    height: 100% !important;
    aspect-ratio: 2 / 1;
  }

  .game-overlay {
    left: 50%;
    width: min(520px, calc(100vw - 120px));
    max-height: calc(100dvh - 58px);
    padding: 0.8rem 1rem;
    transform: translate(-50%, -50%);
  }

  .game-overlay.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.22rem;
    font-size: 0.55rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.25rem, 3.7vw, 1.7rem);
  }

  .game-overlay > #overlayText,
  .game-overlay__hint {
    display: none;
  }

  .game-overlay__score {
    margin: 0.55rem 0;
  }

  .game-overlay__score span {
    padding: 0.45rem;
  }

  .score-form {
    margin: 0.55rem 0;
  }

  .score-form > p {
    display: none;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 38px;
    padding-block: 0.45rem;
  }

  .jump-hint {
    position: absolute;
    z-index: 5;
    right: 1rem;
    bottom: 0.75rem;
    display: block;
    padding: 0.32rem 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(8, 73, 162, 0.72);
    font-size: 0.48rem;
    font-weight: 850;
    text-transform: uppercase;
    pointer-events: none;
  }

  .game-stage.is-menu .jump-hint {
    display: none;
  }
}

@media (max-width: 760px) and (orientation: landscape) and (max-height: 360px) {
  .game-shell {
    grid-template-rows: 40px minmax(0, 1fr);
  }

  .game-hud,
  .hud-item,
  .sound-button {
    height: 40px;
  }

  .game-overlay {
    width: min(500px, calc(100vw - 100px));
    padding-block: 0.55rem;
  }
}

/* iPhone / telefon pionowo: pełna gra i sterowanie, bez ekranu blokującego. */
@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--forest-soft);
  }

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

  .game-page {
    position: fixed;
    inset: 0;
    display: block !important;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  .game-shell {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: calc(42px + env(safe-area-inset-top)) minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    background: var(--forest);
    box-shadow: none;
    filter: none;
    pointer-events: auto;
  }

  .game-hud {
    height: auto;
    padding-top: env(safe-area-inset-top);
  }

  .game-stage {
    position: relative;
    display: flex;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    background: var(--forest-soft);
  }

  #gameCanvas {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 2 / 1;
  }

  .game-overlay,
  .game-overlay--forest {
    left: 50%;
    display: block !important;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay.is-hidden,
  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay--forest .game-overlay__art {
    display: none;
  }

  .game-overlay__copy {
    max-height: none;
    padding: 0.9rem 1rem;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.25rem;
    font-size: 0.58rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.45rem, 7vw, 1.85rem);
  }

  .game-overlay__copy > #overlayText {
    margin-block: 0.55rem 0.7rem;
    font-size: 0.75rem;
    line-height: 1.42;
  }

  .game-overlay__score {
    margin: 0.65rem 0;
  }

  .game-overlay__score span {
    padding: 0.5rem 0.35rem;
  }

  .score-form {
    margin: 0.65rem 0;
  }

  .score-form > p {
    display: none;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 42px;
    padding-block: 0.5rem;
  }

  .game-message {
    display: block !important;
  }

  .touch-controls {
    bottom: calc(0.8rem + env(safe-area-inset-bottom));
    left: 50%;
    display: grid !important;
    transform: translateX(-50%);
  }

  .game-stage.is-menu .touch-controls,
  .game-stage.is-transition .touch-controls {
    visibility: hidden;
    opacity: 0;
  }
}

/* Catcher v2 must remain the final cascade after the retired exploration controls. */
.game-overlay--forest,
.game-overlay--forest.is-result {
  left: 50%;
  display: block;
  grid-template-columns: none;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
  transform: translate(-50%, -50%);
}

.game-overlay--forest.is-hidden {
  transform: translate(-50%, calc(-50% + 8px));
}

.game-overlay--forest .game-overlay__art {
  display: none;
}

.game-overlay__copy,
.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-orientation {
    display: none !important;
  }

  #gameCanvas {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    display: block !important;
    width: min(540px, calc(100vw - 1rem));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.7rem 0.9rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.42rem 0 0.55rem;
    font-size: 0.68rem;
    line-height: 1.38;
  }

  .game-overlay__hint,
  .score-form > p {
    display: none;
  }

  .touch-controls {
    display: none !important;
  }
}

/* v3 mobile catcher: portrait is the natural playfield for falling objects. */
#gameCanvas,
.catch-hint,
.game-overlay--forest,
.game-overlay--forest * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--forest);
  }

  body > .game-page {
    position: fixed;
    inset: 0;
    display: block !important;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  body > .mobile-orientation,
  .skip-link,
  .portal-header,
  .game-heading,
  .leaderboard,
  .game-manual,
  .game-footer {
    display: none !important;
  }

  .game-shell--forest {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: calc(48px + env(safe-area-inset-top)) minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    background: var(--forest);
    box-shadow: none;
    filter: none;
    pointer-events: auto !important;
  }

  .game-hud {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 42px;
    height: auto;
    min-height: 0;
    padding-top: env(safe-area-inset-top);
    overflow: hidden;
  }

  .hud-item,
  .sound-button {
    height: 48px;
    min-height: 0;
  }

  .hud-item {
    padding: 0.32rem 0.36rem;
  }

  .hud-item__label {
    margin-bottom: 0.03rem;
    font-size: 0.39rem;
    letter-spacing: 0.04em;
  }

  .hud-item strong {
    font-size: clamp(0.58rem, 2.8vw, 0.75rem);
  }

  .sound-button {
    width: 42px;
    font-size: 0.9rem;
  }

  .game-stage {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: hidden;
    background-color: var(--forest);
    background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-pion-v1.jpg");
    background-position: center;
    background-size: cover;
  }

  #gameCanvas {
    display: block;
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
    cursor: ew-resize;
    touch-action: none;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    left: 50%;
    display: block !important;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.95rem 1rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.5rem 0 0.65rem;
    font-size: 0.74rem;
    line-height: 1.42;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.2rem;
    font-size: 0.55rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.45rem, 7vw, 1.85rem);
  }

  .game-overlay__score,
  .score-form {
    margin: 0.55rem 0;
  }

  .score-form > p {
    display: none;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 42px;
    padding-block: 0.5rem;
  }

  .game-message {
    display: block !important;
    right: 0.65rem;
    bottom: calc(0.65rem + env(safe-area-inset-bottom));
    left: 0.65rem;
    text-align: center;
  }

  .catch-hint {
    right: calc(0.65rem + env(safe-area-inset-right));
    bottom: calc(0.65rem + env(safe-area-inset-bottom));
    display: block;
  }

  .game-stage.is-menu .catch-hint {
    display: none;
  }
}

/* Keep transient catch feedback compact on touch devices. */
@media (max-width: 1024px),
       (hover: none) and (pointer: coarse) {
  .game-shell--forest .game-message {
    top: 0.45rem;
    right: auto;
    bottom: auto;
    left: 50%;
    width: max-content;
    max-width: calc(100% - 1rem);
    min-height: 0;
    padding: 0.34rem 0.55rem;
    font-size: clamp(0.56rem, 2.5vw, 0.66rem);
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -6px);
  }

  .game-shell--forest .game-message.is-visible {
    transform: translate(-50%, 0);
  }
}

/* Final v2 catcher cascade after the legacy forest rules. */
.game-overlay--forest,
.game-overlay--forest.is-result {
  left: 50%;
  display: block;
  grid-template-columns: none;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
  transform: translate(-50%, -50%);
}

.game-overlay--forest.is-hidden {
  transform: translate(-50%, calc(-50% + 8px));
}

.game-overlay__copy,
.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--forest);
  }

  body > :not(.mobile-orientation) {
    display: none !important;
  }

  .mobile-orientation {
    position: fixed;
    z-index: 300;
    inset: 0;
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #fff;
    background: var(--forest);
    text-align: center;
  }

  .mobile-orientation__phone {
    display: block;
    width: 58px;
    height: 34px;
    border: 3px solid #f2c25d;
    box-shadow: inset 0 0 0 2px var(--forest);
  }

  .mobile-orientation strong {
    max-width: 280px;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 900;
  }

  .mobile-orientation small {
    max-width: 270px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.45;
  }
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-orientation {
    display: none !important;
  }

  .game-stage {
    background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-v2.jpg");
    background-position: center;
    background-size: cover;
  }

  #gameCanvas {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    left: 50%;
    display: block !important;
    width: min(540px, calc(100vw - 1rem));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.7rem 0.9rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.42rem 0 0.55rem;
    font-size: 0.68rem;
    line-height: 1.38;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.15rem;
    font-size: 0.52rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  }

  .game-overlay__hint,
  .score-form > p {
    display: none;
  }

  .game-overlay__score,
  .score-form {
    margin: 0.45rem 0;
  }

  .game-overlay__score span {
    padding: 0.38rem 0.3rem;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 36px;
    padding-block: 0.4rem;
  }

  .catch-hint {
    right: calc(0.6rem + env(safe-area-inset-right));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
  }
}

/* v2 catcher: the supplied poster becomes the playfield. */
.game-stage {
  background-color: var(--forest-soft);
  background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-v2.jpg");
  background-position: center;
  background-size: cover;
}

#gameCanvas {
  cursor: ew-resize;
}

.game-overlay--forest,
.game-overlay--forest.is-result {
  left: 50%;
  display: block;
  grid-template-columns: none;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
  transform: translate(-50%, -50%);
}

.game-overlay--forest.is-hidden {
  transform: translate(-50%, calc(-50% + 8px));
}

.game-overlay__copy,
.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

.catch-hint {
  position: absolute;
  z-index: 5;
  right: 0.85rem;
  bottom: 0.75rem;
  display: none;
  padding: 0.34rem 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(23, 59, 49, 0.82);
  font-size: 0.5rem;
  font-weight: 850;
  text-transform: uppercase;
  pointer-events: none;
}

.game-stage:not(.is-menu) .catch-hint {
  display: block;
}

.game-message.is-positive {
  background: rgba(23, 93, 69, 0.94);
}

.game-message.is-negative {
  background: rgba(147, 49, 38, 0.94);
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--forest);
  }

  body > :not(.mobile-orientation) {
    display: none !important;
  }

  .mobile-orientation {
    position: fixed;
    z-index: 300;
    inset: 0;
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #fff;
    background: var(--forest);
    text-align: center;
  }

  .mobile-orientation__phone {
    display: block;
    width: 58px;
    height: 34px;
    border: 3px solid #f2c25d;
    box-shadow: inset 0 0 0 2px var(--forest);
  }

  .mobile-orientation strong {
    max-width: 280px;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 900;
  }

  .mobile-orientation small {
    max-width: 270px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.45;
  }
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-orientation {
    display: none !important;
  }

  .game-stage {
    background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-v2.jpg");
    background-position: center;
    background-size: cover;
  }

  #gameCanvas {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    left: 50%;
    display: block !important;
    width: min(540px, calc(100vw - 1rem));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay__copy {
    padding: 0.7rem 0.9rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.42rem 0 0.55rem;
    font-size: 0.68rem;
    line-height: 1.38;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.15rem;
    font-size: 0.52rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  }

  .game-overlay__hint,
  .score-form > p {
    display: none;
  }

  .game-overlay__score,
  .score-form {
    margin: 0.45rem 0;
  }

  .game-overlay__score span {
    padding: 0.38rem 0.3rem;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 36px;
    padding-block: 0.4rem;
  }

  .catch-hint {
    right: calc(0.6rem + env(safe-area-inset-right));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
  }
}

@media (min-width: 1025px) and (max-height: 760px) {
  .game-hud,
  .hud-item,
  .sound-button {
    height: 58px;
    min-height: 0;
  }

  .game-hud {
    grid-template-rows: 58px;
    overflow: hidden;
  }

  .hud-item {
    padding-block: 0.4rem;
  }

  .game-stage {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
  }

  #gameCanvas {
    width: min(100%, calc((100dvh - 61px) * 2)) !important;
    height: auto !important;
    aspect-ratio: 2 / 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/* Chodź na grzyby — plakatowy las */
.game-shell--forest {
  border-top-color: var(--forest);
  background: var(--forest);
}

.game-shell--forest .game-hud {
  background: var(--forest);
}

.game-shell--forest .sound-button:hover,
.game-shell--forest .sound-button:focus-visible {
  color: var(--forest);
  background: #d7e8d9;
}

.game-overlay--forest {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  width: min(800px, calc(100% - 2rem));
  padding: 0;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(17, 38, 31, 0.28);
}

.game-overlay__art {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background: var(--forest);
}

.game-overlay__art::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 64%, rgba(255, 255, 255, 0.14));
  content: "";
  pointer-events: none;
}

.game-overlay__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 51%;
}

.game-overlay__copy {
  align-self: center;
  max-height: calc(100% - 1rem);
  padding: clamp(1.25rem, 2.4vw, 2rem);
  overflow-y: auto;
}

.game-overlay__copy > #overlayText {
  margin: 0.8rem 0 0;
  color: rgba(17, 17, 17, 0.72);
  font-size: 0.88rem;
  line-height: 1.58;
}

.game-overlay--forest.is-result {
  display: block;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
}

.game-overlay--forest.is-result .game-overlay__art {
  display: none;
}

.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
}

.touch-controls {
  position: absolute;
  z-index: 7;
  bottom: 0.85rem;
  left: 0.85rem;
  display: none;
  grid-template: repeat(3, 44px) / repeat(3, 44px);
  gap: 4px;
  width: 140px;
  height: 140px;
  touch-action: none;
  user-select: none;
}

.touch-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #fff;
  background: rgba(23, 59, 49, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(14, 40, 31, 0.2);
  font-size: 1rem;
  font-weight: 900;
  touch-action: none;
}

.touch-controls button[data-direction="up"] { grid-area: 1 / 2; }
.touch-controls button[data-direction="left"] { grid-area: 2 / 1; }
.touch-controls button[data-direction="down"] { grid-area: 2 / 2; }
.touch-controls button[data-direction="right"] { grid-area: 2 / 3; }

.touch-controls button.is-active {
  color: var(--forest);
  background: #f2c25d;
  transform: translateY(1px);
}

.game-stage.is-menu .touch-controls,
.game-stage.is-transition .touch-controls {
  visibility: hidden;
  opacity: 0;
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .touch-controls {
    display: none !important;
  }

  .mobile-orientation strong {
    background: rgba(23, 59, 49, 0.94);
    border-color: rgba(242, 194, 93, 0.9);
  }
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  html,
  body,
  .game-stage {
    background: var(--forest-soft);
  }

  .game-overlay--forest {
    left: 50%;
    display: block;
    width: min(520px, calc(100vw - 150px));
    padding: 0;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay--forest .game-overlay__art {
    display: none;
  }

  .game-overlay__copy {
    padding: 0.75rem 1rem;
  }

  .game-overlay__copy > #overlayText,
  .game-overlay__hint {
    display: none;
  }

  .touch-controls {
    display: grid;
  }
}

@media (max-width: 760px) and (orientation: landscape) and (max-height: 360px) {
  .touch-controls {
    bottom: 0.35rem;
    left: 0.45rem;
    grid-template: repeat(3, 38px) / repeat(3, 38px);
    gap: 3px;
    width: 120px;
    height: 120px;
  }

  .touch-controls button {
    width: 38px;
    height: 38px;
  }
}

/* Forest-specific rules live later in this stylesheet, so keep portrait overrides last. */
@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .game-overlay--forest {
    left: 50%;
    display: block !important;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay--forest .game-overlay__art {
    display: none;
  }

  .game-overlay__copy {
    max-height: none;
    padding: 0.9rem 1rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin-block: 0.55rem 0.7rem;
    font-size: 0.75rem;
    line-height: 1.42;
  }

  .touch-controls {
    bottom: calc(0.8rem + env(safe-area-inset-bottom));
    left: 50%;
    display: grid !important;
    transform: translateX(-50%);
  }

  .game-stage.is-menu .touch-controls,
  .game-stage.is-transition .touch-controls {
    visibility: hidden;
    opacity: 0;
  }
}

/* Catcher v2 must be the final cascade after the retired exploration controls. */
.game-overlay--forest,
.game-overlay--forest.is-result {
  left: 50%;
  display: block;
  grid-template-columns: none;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
  transform: translate(-50%, -50%);
}

.game-overlay--forest.is-hidden {
  transform: translate(-50%, calc(-50% + 8px));
}

.game-overlay__copy,
.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--forest);
  }

  body > :not(.mobile-orientation) {
    display: none !important;
  }

  .mobile-orientation {
    position: fixed;
    z-index: 300;
    inset: 0;
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #fff;
    background: var(--forest);
    text-align: center;
  }

  .mobile-orientation__phone {
    display: block;
    width: 58px;
    height: 34px;
    border: 3px solid #f2c25d;
    box-shadow: inset 0 0 0 2px var(--forest);
  }

  .mobile-orientation strong {
    max-width: 280px;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 900;
  }

  .mobile-orientation small {
    max-width: 270px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.45;
  }
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-orientation {
    display: none !important;
  }

  .game-stage {
    background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-v2.jpg");
    background-position: center;
    background-size: cover;
  }

  #gameCanvas {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    left: 50%;
    display: block !important;
    width: min(540px, calc(100vw - 1rem));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.7rem 0.9rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.42rem 0 0.55rem;
    font-size: 0.68rem;
    line-height: 1.38;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.15rem;
    font-size: 0.52rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  }

  .game-overlay__hint,
  .score-form > p {
    display: none;
  }

  .game-overlay__score,
  .score-form {
    margin: 0.45rem 0;
  }

  .game-overlay__score span {
    padding: 0.38rem 0.3rem;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 36px;
    padding-block: 0.4rem;
  }

  .catch-hint {
    right: calc(0.6rem + env(safe-area-inset-right));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
  }
}

/* Final catcher v2 cascade — intentionally the last rules in this file. */
.game-overlay--forest,
.game-overlay--forest.is-result {
  left: 50%;
  display: block;
  grid-template-columns: none;
  width: min(540px, calc(100% - 2rem));
  padding: 0;
  transform: translate(-50%, -50%);
}

.game-overlay--forest.is-hidden {
  transform: translate(-50%, calc(-50% + 8px));
}

.game-overlay--forest .game-overlay__art {
  display: none;
}

.game-overlay__copy,
.game-overlay--forest.is-result .game-overlay__copy {
  max-height: calc(100% - 1rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

@media (max-width: 1024px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-orientation {
    display: none !important;
  }

  #gameCanvas {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    display: block !important;
    width: min(540px, calc(100vw - 1rem));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.7rem 0.9rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.42rem 0 0.55rem;
    font-size: 0.68rem;
    line-height: 1.38;
  }

  .game-overlay__hint,
  .score-form > p {
    display: none;
  }

  .touch-controls {
    display: none !important;
  }
}

/* Final mobile contract: mushrooms are portrait-first; keep this block last. */
#gameCanvas,
.catch-hint,
.game-overlay--forest,
.game-overlay--forest * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px) and (orientation: portrait),
       (hover: none) and (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--forest);
  }

  body > :not(.game-page) {
    display: none !important;
  }

  body > .game-page {
    position: fixed;
    inset: 0;
    display: block !important;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  .game-shell--forest {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: calc(48px + env(safe-area-inset-top)) minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    background: var(--forest);
    box-shadow: none;
    filter: none;
    pointer-events: auto !important;
  }

  .game-hud {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 42px;
    height: auto;
    min-height: 0;
    padding-top: env(safe-area-inset-top);
    overflow: hidden;
  }

  .hud-item,
  .sound-button {
    height: 48px;
    min-height: 0;
  }

  .hud-item {
    padding: 0.32rem 0.36rem;
  }

  .hud-item__label {
    margin-bottom: 0.03rem;
    font-size: 0.39rem;
    letter-spacing: 0.04em;
  }

  .hud-item strong {
    font-size: clamp(0.58rem, 2.8vw, 0.75rem);
  }

  .sound-button {
    width: 42px;
    font-size: 0.9rem;
  }

  .game-stage {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: hidden;
    background-color: var(--forest);
    background-image: url("assets/images/plakat-chodz-na-grzyby-tlo-pion-v1.jpg");
    background-position: center;
    background-size: cover;
  }

  #gameCanvas {
    display: block;
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    aspect-ratio: auto;
    cursor: ew-resize;
    touch-action: none;
  }

  .game-overlay--forest,
  .game-overlay--forest.is-result {
    left: 50%;
    display: block !important;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  .game-overlay--forest.is-hidden {
    transform: translate(-50%, calc(-50% + 8px));
  }

  .game-overlay--forest .game-overlay__art {
    display: none;
  }

  .game-overlay__copy,
  .game-overlay--forest.is-result .game-overlay__copy {
    max-height: none;
    padding: 0.95rem 1rem;
  }

  .game-overlay__copy > #overlayText {
    display: block;
    margin: 0.5rem 0 0.65rem;
    font-size: 0.74rem;
    line-height: 1.42;
  }

  .game-overlay__eyebrow {
    margin-bottom: 0.2rem;
    font-size: 0.55rem;
  }

  .game-overlay h2 {
    font-size: clamp(1.45rem, 7vw, 1.85rem);
  }

  .game-overlay__score,
  .score-form {
    margin: 0.55rem 0;
  }

  .score-form > p {
    display: none;
  }

  .primary-button,
  .score-form button,
  .score-form input {
    min-height: 42px;
    padding-block: 0.5rem;
  }

  .game-message {
    right: 0.65rem;
    bottom: calc(0.65rem + env(safe-area-inset-bottom));
    left: 0.65rem;
    display: block !important;
    text-align: center;
  }

  .catch-hint {
    right: calc(0.65rem + env(safe-area-inset-right));
    bottom: calc(0.65rem + env(safe-area-inset-bottom));
    display: block;
  }

  .game-stage.is-menu .catch-hint {
    display: none;
  }
}
