/* Mobile game layout refinements. Kept separate from the shared site stylesheet. */
.snake-start-hint,
.reaction-start-hint,
.pampuch-mobile-start,
.pampuch-mobile-controls,
.pampuch-scroll-surface {
  display: none;
}

@media (max-width: 720px) {
  .game-page .game-main {
    padding-top: 26px;
    padding-bottom: 64px;
  }

  .game-page .game-intro {
    margin-bottom: 20px;
  }

  .game-page .game-intro h1 {
    font-size: clamp(43px, 14vw, 58px);
    letter-spacing: -2px;
  }

  .game-page .game-intro > p {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.55;
  }

  .game-page .game-toolbar {
    min-height: 50px;
    padding-inline: 13px;
  }

  .game-page .toolbar-title {
    gap: 7px;
    min-width: 0;
  }

  .game-page .toolbar-title strong {
    white-space: nowrap;
  }

  .game-page .toolbar-title small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .game-page .game-hint {
    padding: 10px 13px;
    font-size: 11px;
    line-height: 1.45;
  }

  .game-page .game-info {
    margin-top: 20px;
  }

  /* Had: one compact status block, the game and a single row of controls. */
  .snake-page .snake-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .snake-page .snake-title {
    min-width: 0;
  }

  .snake-page .snake-title small {
    display: none;
  }

  .snake-page .snake-pickup {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 42px;
    padding: 7px 10px;
  }

  .snake-page .snake-pickup strong {
    font-size: 12px;
  }

  .snake-page .snake-pickup small {
    font-size: 9px;
  }

  .snake-page .snake-stats {
    grid-column: 2;
    grid-row: 1;
    width: auto;
  }

  .snake-page .snake-stats > span {
    min-width: 47px;
    padding: 5px 7px;
  }

  .snake-page .snake-stats small {
    font-size: 7px;
  }

  .snake-page .snake-stats strong {
    font-size: 18px;
  }

  .snake-page .snake-scorebar {
    flex-wrap: nowrap;
    gap: 14px;
    overflow-x: auto;
    padding: 8px 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .snake-page .snake-scorebar::-webkit-scrollbar {
    display: none;
  }

  .snake-page .snake-scorebar a {
    display: none;
  }

  .snake-page .snake-stage {
    min-height: 244px;
    touch-action: pan-y;
  }

  .snake-page #start-panel {
    padding: 14px 16px;
  }

  .snake-page #start-panel .snake-logo,
  .snake-page #start-panel > p:not(.eyebrow) {
    display: none;
  }

  .snake-page #start-panel h2 {
    margin: 2px 0 13px;
    font-size: clamp(28px, 9vw, 38px);
    line-height: 1.02;
    letter-spacing: -1.5px;
  }

  .snake-page #start-panel .button {
    min-height: 48px;
    margin-top: 0;
  }

  .snake-page .snake-start-hint,
  .reaction-page .reaction-start-hint {
    display: block;
    margin-top: 10px;
    color: #8fbde8;
    font-size: 10px;
    line-height: 1.4;
  }

  .snake-page .snake-result {
    justify-content: flex-start;
    overflow-y: auto;
    padding: 17px 14px;
    -webkit-overflow-scrolling: touch;
  }

  .snake-page .snake-result h2 {
    margin: 2px 0 6px;
    font-size: 34px;
    letter-spacing: -1px;
  }

  .snake-page .snake-result > p {
    margin-block: 3px 8px;
  }

  .snake-page .snake-reward {
    margin-block: 7px;
  }

  .snake-page .snake-controls {
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(2, 52px);
    gap: 7px;
    padding: 9px 12px;
    touch-action: pan-y;
  }

  .snake-page .snake-controls button {
    min-width: 52px;
    min-height: 52px;
    border-radius: 10px;
  }

  .snake-page .snake-controls [data-direction="up"] { grid-column: 2; grid-row: 1; }
  .snake-page .snake-controls [data-direction="left"] { grid-column: 1; grid-row: 2; }
  .snake-page .snake-controls [data-direction="down"] { grid-column: 2; grid-row: 2; }
  .snake-page .snake-controls [data-direction="right"] { grid-column: 3; grid-row: 2; }

  /* Postreh: keep the action and the whole result inside the visible game card. */
  .reaction-page .reaction-field {
    min-height: clamp(390px, 62svh, 460px);
  }

  .reaction-page .reaction-start {
    padding: 18px 14px;
    cursor: pointer;
  }

  .reaction-page .reaction-demo {
    width: 72px;
    height: 72px;
    font-size: 20px;
    box-shadow: 0 0 0 12px rgba(80, 167, 255, .1), 0 0 35px rgba(80, 167, 255, .24);
  }

  .reaction-page .reaction-start h2 {
    margin: 13px 0 6px;
    font-size: 34px;
  }

  .reaction-page .reaction-start > p {
    margin: 0 0 14px;
    font-size: 13px;
  }

  .reaction-page .reaction-start .button {
    min-height: 48px;
  }

  .reaction-page .reaction-result {
    justify-content: flex-start;
    overflow-y: auto;
    padding: 16px 14px;
    -webkit-overflow-scrolling: touch;
  }

  .reaction-page .reaction-result h2 {
    margin: 4px 0;
    font-size: 36px;
  }

  .reaction-page .reaction-result > p {
    margin: 2px 0 5px;
  }

  .reaction-page .reaction-result .reward-box {
    margin: 8px 0 12px;
  }

  /* The Pampuch frame needs room for the HUD, canvas and controls below it. */
  .pampuch-page .game-viewport {
    position: relative;
    width: 100%;
    height: clamp(350px, 55svh, 470px);
    max-height: none;
    aspect-ratio: auto;
    touch-action: pan-y;
  }

  .pampuch-page .game-viewport iframe {
    pointer-events: none;
  }

  .pampuch-scroll-surface {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: block;
    background: transparent;
    touch-action: pan-y;
    overscroll-behavior-y: auto;
  }

  .pampuch-mobile-start {
    position: absolute;
    z-index: 5;
    left: 50%;
    top: 50%;
    min-width: 150px;
    min-height: 52px;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #061426;
    border-radius: 9px;
    color: #061426;
    background: #ffd43b;
    box-shadow: 0 7px 0 rgba(6, 20, 38, .75);
    font-family: inherit;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.1;
    transform: translate(-50%, -50%);
    cursor: pointer;
    touch-action: manipulation;
  }

  .pampuch-mobile-start.is-started {
    display: none;
  }

  .pampuch-mobile-controls {
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, 58px);
    grid-template-rows: repeat(2, 58px);
    justify-content: center;
    gap: 8px;
    background: #06182b;
    border-top: 2px solid #ffd43b;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .pampuch-mobile-controls button {
    width: 58px;
    height: 58px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 13px;
    color: white;
    background: #0c335b;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
    font: 900 29px/1 system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
  }

  .pampuch-mobile-controls button:active,
  .pampuch-mobile-controls button.is-active {
    color: #06182b;
    background: #ffd43b;
    border-color: #ffd43b;
    transform: translateY(1px);
  }

  .pampuch-mobile-controls [data-direction="up"] { grid-column: 2; grid-row: 1; }
  .pampuch-mobile-controls [data-direction="left"] { grid-column: 1; grid-row: 2; }
  .pampuch-mobile-controls [data-direction="down"] { grid-column: 2; grid-row: 2; }
  .pampuch-mobile-controls [data-direction="right"] { grid-column: 3; grid-row: 2; }

  /* Ladinek keeps all six holes and its result panel in the iframe on phones. */
  .ladinek-page .ladinek-frame {
    height: clamp(450px, 70svh, 540px);
  }
}

@media (max-width: 390px) {
  .snake-page .snake-title strong {
    font-size: 13px;
  }

  .snake-page .snake-stats > span {
    min-width: 43px;
    padding-inline: 5px;
  }

  .snake-page .snake-controls {
    grid-template-columns: repeat(3, 49px);
    grid-template-rows: repeat(2, 49px);
  }

  .snake-page .snake-controls button {
    min-width: 49px;
    min-height: 49px;
  }

  .reaction-page .reaction-stats > div {
    padding-inline: 10px;
  }
}
