:root {
  --btn-size: 36px;     /* round corner buttons: music + WhatsApp share */
  /* Board width = the full background image, scaled uniformly (never stretched) to cover the viewport.
     back_desktop_new.jpg is 1376x768. Scale follows the height; a wider screen scales up to the width,
     but never more than 16% over the height fit so the holes stay clear of the top/bottom edges. */
  --sw: min(max(calc(100dvh * 1.791667), 100vw), calc(100dvh * 2.0833));
  --cx: max(0px, calc((var(--sw) - 100vw) / 2));                    /* board part cropped off each side */
  --cy: max(0px, calc((var(--sw) / 1.791667 - 100dvh) / 2));        /* board part cropped off top/bottom */
  --u: calc(var(--sw) / 100);                                       /* 1% of board width */
  --fill: #122c37;                                                  /* matches the image edges outside the board */
  --start-bg: #F5F5F5;                                              /* opening screen only */
  --screen-bg: #F5F5F5;                                             /* game over / victory / level screens: same as the opening screen */
  --hud-fs: max(12px, min(24px, calc(var(--u) * 1.7)));
  --blue: #2f7fe0;
  --blue-dark: #1b4a9a;
  --purple: #8e3cc9;
  --purple-dark: #5a2290;
  --green: #25D366;
  --green-dark: #128C7E;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  direction: rtl;               /* Hebrew UI: punctuation and numbers follow RTL rules */
}

body {
  background: var(--fill);
  color: #fff;
  font-family: "Rubik", "Heebo", "Segoe UI", Arial, sans-serif;
  font-weight: 800;
  touch-action: manipulation;
}

img { -webkit-user-drag: none; }

/* ---------- Which screen is visible ---------- */
.screen { display: none; }
body[data-screen="start"] #startScreen { display: grid; }
body[data-screen="level2"] #level2Screen,
body[data-screen="level3"] #level3Screen,
body[data-screen="lose"] #loseScreen,
body[data-screen="win"] #winScreen { display: flex; }

body:not([data-screen="game"]) #app,
body:not([data-screen="game"]) .amch-logo,
body:not([data-screen="game"]) .overlay { display: none; }

/* ---------- Shared full-screen styling (start / game over / victory) ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--screen-bg);
  color: #1b2a33;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: hidden;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  direction: rtl;
  font-size: clamp(24px, 5.5vw, 34px);
  color: #fff;
  padding: .45em 1.7em;
  border: 0;
  border-bottom: 7px solid var(--blue-dark);
  border-radius: 20px;
  background: linear-gradient(#4f9bf5, var(--blue));
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .4);
  cursor: pointer;
  transition: transform .06s ease, border-bottom-width .06s ease;
}
.btn:active { transform: translateY(4px); border-bottom-width: 3px; }
.btn-primary {
  border-bottom-color: var(--purple-dark);
  background: linear-gradient(#b05ae6, var(--purple));
}
.btn-share {
  border-bottom-color: var(--green-dark);
  background: linear-gradient(#3fe582, var(--green));
}

/* ---------- Start screen ---------- */
/* Desktop: character | logo + text + button | character. The grid is laid out left-to-right,
   the text inside stays RTL. */
.start-screen {
  background: var(--start-bg);
  color: #1b2a33;
  direction: ltr;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(8px, 2vw, 32px);
}
/* The character files are wide transparent canvases (1380x752) with the figure in the middle.
   The files are used as-is: each <img> is a window onto its figure (aspect-ratio + object-position),
   sized to fit its cell, so no image has to be edited. */
.ss-cell {
  container-type: size;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: min(76dvh, 700px);
  min-width: 0;
  pointer-events: none;
}
.ss-cell1 { grid-column: 1; justify-content: flex-end; }     /* stand toward the centre */
.ss-cell2 { grid-column: 3; justify-content: flex-start; }
.ss-man {
  display: block;
  width: min(100cqw, calc(100cqh * var(--ar)));
  height: auto;
  aspect-ratio: var(--ar);
  object-fit: cover;
  object-position: var(--px) 50%;
}
.ss-man1, .side-man { --ar: .565; --px: 57.8%; }                /* man1_new.png */
.ss-man2 { --ar: .3936; --px: 49.3%; transform: scaleX(-1); }   /* man2_new.png, mirrored on the start screen only */

.ss-center {
  grid-column: 2;
  direction: rtl;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 4dvh, 40px);
  text-align: center;
}
.ss-logo { width: min(100%, 62dvh); height: auto; transform: translateY(-4dvh); }
.ss-br { display: none; }
.ss-tagline {
  margin: 0;
  max-width: 30em;
  font-size: clamp(15px, min(1.55vw, 2.9dvh), 26px);
  line-height: 1.5;
  font-weight: 700;
  text-wrap: pretty;
  transform: translateY(-4dvh);
}
.ss-btn { font-size: clamp(28px, 3.2vw, 46px); }

/* Flag: flat graphic in the upper-right corner, tilted clockwise and cropped by the screen edges.
   z-index -1 keeps it behind every other element of the start screen. */
.ss-flag {
  position: absolute;
  z-index: -1;
  top: -2.5vw;
  right: -0.5vw;
  width: 25vw;
  height: auto;
  transform: rotate(12deg);
  transform-origin: center;
  opacity: .75;
  pointer-events: none;
}

.ss-star { display: none; }

.ss-amch {
  position: absolute;
  top: 8px;
  left: 8px;
  width: clamp(80px, 9.5vw, 140px);
  pointer-events: none;
}

/* ---------- Game Over / Victory screens ---------- */
.end-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3dvh, 28px);
  text-align: center;
}
.end-title {
  margin: 0;
  font-size: clamp(40px, 9vw, 96px);
  line-height: 1.1;
  font-weight: 900;
  text-wrap: balance;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .18);
}
.end-title.lose { color: #e5533f; }
.end-title.win { color: #e8a000; }
.end-text {
  margin: 0;
  max-width: min(92vw, 24em);
  font-size: clamp(20px, 3.2vw, 38px);
  line-height: 1.35;
  text-wrap: balance;
  opacity: .92;
}
.end-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: clamp(8px, 2dvh, 20px);
}
.end-buttons .btn { min-width: 8em; }

/* Victory: title toward the top, then the line, then an empty area reserved for an image, then buttons */
.win-screen {
  justify-content: flex-start;
  padding-top: max(24px, 9dvh);
}
/* Victory and Game Over: text at the top, the full image centered in the free space, buttons at the bottom */
.lose-screen {
  justify-content: flex-start;
  padding-top: max(24px, 9dvh);
}
.win-screen, .lose-screen {
  padding-bottom: max(20px, 4dvh, env(safe-area-inset-bottom));
  padding-inline: 16px;
}
.end-img {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lose-screen .end-text { max-width: min(94vw, 42em); }
.lose-screen .end-img .crop { width: min(100cqw, calc(97cqh * var(--k))); }
.end-img img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;   /* always shown whole, never cropped */
}

/* Level transition screens: identical layout on both, so heading, text, image and button sit at the same place */
.level-screen {
  justify-content: flex-start;
  padding-top: max(24px, 9dvh);
  padding-bottom: max(20px, 4dvh, env(safe-area-inset-bottom));
  padding-inline: 16px;
}
.level-screen .end-text { min-height: calc(2 * 1.35em); }
.level-img {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* The artwork sits inside a wide transparent canvas: the window shows exactly the figure, the file itself is untouched */
.level-img, .end-img { container-type: size; }
.level-img .crop, .end-img .crop { position: relative; overflow: hidden; height: auto; width: min(100cqw, calc(100cqh * var(--k))); }
.level-img .crop img, .end-img .crop img { position: absolute; display: block; width: var(--w); height: auto; left: var(--l); top: var(--t); max-width: none; max-height: none; object-fit: fill; }
@media (max-width: 700px) {
  .level-screen .end-text { min-height: calc(3 * 1.35em); }
}

/* Music toggle: small round button, top right, above every screen */
.music-btn {
  position: fixed;
  z-index: 40;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  width: var(--btn-size);
  height: var(--btn-size);
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 48, 61, .78);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 255, 255, .35);
  cursor: pointer;
}
.music-btn:active { transform: scale(.94); }
.music-btn svg { width: calc(var(--btn-size) * .6); height: calc(var(--btn-size) * .6); }

/* WhatsApp share: same size as the music button, directly under it (top-right). Hidden on win / lose. */
.share-btn {
  position: fixed;
  z-index: 40;
  top: calc(max(8px, env(safe-area-inset-top)) + var(--btn-size) + 8px);
  right: max(8px, env(safe-area-inset-right));
  width: var(--btn-size);
  height: var(--btn-size);
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #25D366;   /* WhatsApp green */
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 255, 255, .35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.share-btn:active { transform: scale(.94); }
.share-btn svg { width: calc(var(--btn-size) * .6); height: calc(var(--btn-size) * .6); }
.share-btn .sb-bubble { stroke: #fff; }
.share-btn .sb-phone { fill: #fff; }
body[data-screen="win"] .share-btn,
body[data-screen="lose"] .share-btn { display: none; }
.music-btn .mb-speaker { fill: #fff; }
.music-btn .mb-wave, .music-btn .mb-cross { stroke: #fff; }
.music-btn .mb-cross { display: none; stroke: #ff7a6b; }
.music-btn[aria-pressed="true"] .mb-wave { display: none; }
.music-btn[aria-pressed="true"] .mb-cross { display: inline; }

/* ---------- Gameplay screen ---------- */
#app {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The board is the complete background image. Everything else is positioned in % of it. */
.board {
  position: relative;
  flex: none;
  width: var(--sw);
  aspect-ratio: 1376 / 768;
  background: url("assets/back_desktop_new.jpg") center / 100% 100% no-repeat;
  touch-action: none;
}
.board.shake { animation: shake .22s linear; }

.amch-logo {
  position: fixed;
  top: 8px;
  left: 8px;
  width: clamp(80px, 9.5vw, 140px);
  z-index: 5;
  pointer-events: none;
}

/* Desktop only: the character stands in the left-hand side area, outside the hole grid */
.side-man {
  position: absolute;
  z-index: 1;
  left: 2vw;
  bottom: 0;
  width: min(calc(var(--sw) * .22), calc(50vw - 0.223 * var(--sw) - 3.5vw), calc(70dvh * var(--ar)));
  height: auto;
  aspect-ratio: var(--ar);
  object-fit: cover;
  object-position: var(--px) 50%;
  pointer-events: none;
}

/* Desktop: one info panel in the right-hand side area (logo, score, misses, timer). */
.top-zone {
  position: absolute;
  z-index: 1;
  top: calc(var(--cy) + 11%);
  right: calc(var(--cx) + 2vw);
  width: min(23%, calc(50vw - 0.223 * var(--sw) - 3.5vw));   /* free space right of the hole grid */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(var(--u) * 1.6);
  pointer-events: none;
}
.game-logo { width: 100%; height: auto; }

/* ---------- HUD ---------- */
.hud {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * .8);
  font-size: var(--hud-fs);
}
.hud #hudScore  { order: 1; }
.hud #hudMisses { order: 2; }
.hud #hudTime   { order: 3; }

.hud-item {
  padding: .3em .8em;
  border-radius: 999px;
  background: rgba(0, 0, 0, .4);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .4);
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.slots, .fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.slots { z-index: 2; }
.fx { z-index: 3; }

.slot {
  position: absolute;
  transform: translate(-50%, -100%);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.target {
  flex: none;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: translateY(105%);
  transition: transform .13s cubic-bezier(.2, .9, .3, 1.15);
}
.target.up { transform: translateY(0); }
.target.down { transform: translateY(105%); transition-duration: .11s; transition-timing-function: ease-in; }

/* ---------- Effects ---------- */
.fx-item {
  position: absolute;
  transform: translate(-50%, -50%);
  animation: fxpop .45s ease-out forwards;
}
.fx-item img { display: block; width: 100%; height: auto; }
.fx-impact { width: 17%; }
.fx-miss { width: 8%; animation-duration: .4s; }
.fx-combo { width: 26%; animation-duration: .75s; }

/* Hand + hammer rest below the hole grid: the whole head and part of the arm show above the screen edge */
.hammer {
  position: absolute;
  z-index: 4;
  left: 44.5%;
  top: calc(100% - var(--cy) - 17%);
  width: 11%;
  height: auto;
  transform-origin: 40% 36%;
  pointer-events: none;
  will-change: transform;
}

.feedback {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: calc(var(--cy) + 1.5%);
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  font-size: max(18px, min(46px, calc(var(--u) * 3.4)));
  color: #fff;
  -webkit-text-stroke: 2px rgba(20, 8, 4, .85);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .45);
}
.feedback.show { animation: fbpop .8s ease-out forwards; }
.feedback.good { color: #ffd54a; }
.feedback.bad { color: #ff7a6b; }

/* ---------- Countdown ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay.countdown { pointer-events: none; font-size: clamp(80px, 22vw, 200px); }
.overlay.countdown span {
  -webkit-text-stroke: 4px rgba(20, 8, 4, .85);
  paint-order: stroke fill;
  text-shadow: 0 8px 0 rgba(0, 0, 0, .4);
  animation: cdpop .5s ease-out;
}

/* ---------- Animations ---------- */
@keyframes fxpop {
  0%   { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  35%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
@keyframes fbpop {
  0%   { transform: translateX(-50%) scale(.6); opacity: 0; }
  20%  { transform: translateX(-50%) scale(1.15); opacity: 1; }
  70%  { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-12px) scale(1); opacity: 0; }
}
@keyframes cdpop {
  from { transform: scale(1.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Mobile: portrait screens use back_mobile_new.jpg ---------- */
@media (max-aspect-ratio: 1/1) {
  :root {
    --sw: min(100vw, calc(100dvh * 0.558140));  /* back_mobile_new.jpg is 768x1376 */
    --cx: 0px;
    --cy: 0px;
    --fill: #e6e5e1;
    --hud-fs: max(11px, calc(var(--u) * 3.4));
  }

  /* Start screen (mobile): game logo, secondary logo, text from the top; the two characters are enlarged, upper
     body only, at the bottom edge, close together; the button sits over them; a Star of David behind everything. */
  .start-screen {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 1fr auto;
    justify-items: center;
    align-content: stretch;
    row-gap: clamp(4px, 1dvh, 10px);
    column-gap: 0;
    padding-top: 24px;
  }
  .ss-center { display: contents; }
  .ss-logo { grid-area: 2 / 1 / 3 / 3; width: auto; height: 16dvh; max-width: 90vw; object-fit: contain; transform: none; }
  /* logo_amch.png is a 500x500 canvas with the artwork in a thin band: the img is a window onto that band */
  .ss-amch { position: static; grid-area: 1 / 1 / 2 / 3; width: min(58vw, 250px); height: auto; aspect-ratio: 500 / 121; object-fit: cover; object-position: 50% 50%; }
  .ss-tagline { grid-area: 3 / 1 / 4 / 3; max-width: 94vw; margin-top: clamp(8px, 1.8dvh, 16px); font-size: clamp(14px, min(4.5vw, 2.5dvh), 22px); line-height: 1.4; transform: none; }

  /* Characters: --H is the height of each image window; the lower part of the figure falls below the screen edge */
  /* Characters: the two separate figures side by side, in the space between the text and the button.
     Each cell is one half of that space; the figures are upper-body (cropped at the cell's bottom edge). */
  .ss-cell {
    grid-area: 4 / 1 / 5 / 2;
    align-self: stretch;
    align-items: flex-start;
    container-type: size;
    width: 100%;
    height: auto;
    min-height: 0;
    clip-path: inset(-100vh -100vw 0 -100vw);   /* only the bottom edge crops the figures */
    translate: 8vw 0;                           /* centres the pair (the figures' windows have more room on the left) */
  }
  .ss-cell1 { grid-column: 1; justify-content: flex-end; }
  .ss-cell2 { grid-column: 2; justify-content: flex-start; }
  .ss-man {
    --H: min(100cqh / 0.97, 100vw);     /* figure height: the whole body fits the space */
    width: auto;
    height: var(--H);
    margin-top: calc(var(--H) * -0.05);
    aspect-ratio: var(--ar);
    object-fit: cover;
    object-position: var(--px) 50%;
  }
  .ss-man1 { position: relative; z-index: 2; }

  .ss-btn {
    grid-area: 5 / 1 / 6 / 3;
    margin-bottom: max(14px, env(safe-area-inset-bottom));
    justify-self: center;
    padding-inline: 1.5em;
    font-size: clamp(22px, 6.2vw, 34px);
  }

  .ss-flag { display: none; }
  .ss-star {
    display: block;
    position: absolute;
    z-index: -1;
    left: 50%;
    top: 44%;
    width: 86vw;
    height: auto;
    transform: translate(-50%, -50%);
    opacity: .1;
    pointer-events: none;
  }

  /* Gameplay */
  #app { align-items: flex-end; }
  .side-man { display: none; }

  /* Secondary logo: centred above the game logo (anchored to the same board geometry as .top-zone).
     logo_amch.png is a 500x500 canvas with a thin band of artwork: the img is a window onto that band. */
  .amch-logo {
    top: auto; left: 50%;
    width: calc(var(--sw) * 0.64); height: auto;
    aspect-ratio: 500 / 121; object-fit: cover; object-position: 50% 50%;
    bottom: calc(var(--sw) * 1.7918 * 0.645 + var(--u) * 45.7);
    transform: translateX(-50%);
  }

  .board {
    aspect-ratio: 768 / 1376;
    background-image: url("assets/back_mobile_new.jpg");
  }

  /* Logo + HUD stack in the clean area above the first row of holes */
  .top-zone {
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    top: auto;
    width: auto;
    bottom: 64.5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--u) * 2);
    pointer-events: none;
  }
  .game-logo {
    width: 50%;
    margin-bottom: calc(var(--u) * 13);
  }
  .hud #hudScore, .hud #hudMisses, .hud #hudTime { order: 0; }
  .hud {
    width: 92%;
    flex-direction: row;
    justify-content: space-between;
    gap: calc(var(--u) * 1.5);
  }
  .hud-item { padding: .3em .7em; }

  .fx-impact { width: 34%; }
  .fx-miss { width: 16%; }
  .fx-combo { width: 52%; }

  .hammer { left: 38%; top: 88.5%; width: 24%; }

  .feedback {
    top: auto;
    bottom: calc(64.5% + var(--u) * 8.5);
    font-size: max(18px, calc(var(--u) * 5.5));
  }

  .end-title { font-size: clamp(34px, 10vw, 72px); }
  .end-buttons { flex-direction: column; align-items: center; gap: 16px; }       /* stacked: primary, then share */
  .end-buttons .btn { width: min(80vw, 320px); min-width: 0; padding-inline: 1em; font-size: clamp(22px, 6.5vw, 30px); }
}

/* =====================================================================================
   DESKTOP ONLY (everything that is not the portrait/mobile layout, which is the
   (max-aspect-ratio: 1/1) block above). Nothing in here applies on mobile.
   ===================================================================================== */
@media not all and (max-aspect-ratio: 1/1) {
  /* very wide screens letterbox the board: match the new (light) board edges instead of the old dark ones */
  body { background: #c6c6c6; }
  /* Start screen: no flag, main logo a little higher, larger secondary logo */
  .ss-flag { display: none; }
  /* logo_amch.png is a 500x500 canvas whose artwork starts 6.6% from the left and 39.6% from the top:
     the shift lets the artwork itself touch the top-left corner (the file is untouched) */
  .amch-logo { top: 2px; left: 2px; width: clamp(120px, 14vw, 210px); transform: translate(-6.6%, -39.6%); }
  /* start screen: secondary logo sits above the main logo (window onto the artwork band of the 500x500 file) */
  .ss-amch { position: static; width: clamp(190px, 22vw, 340px); height: auto; aspect-ratio: 500 / 121; object-fit: cover; object-position: 50% 50%; transform: translateY(-11dvh); }
  .ss-br { display: inline; }
  .ss-logo { width: min(100%, 45dvh); transform: translateY(-13dvh); }
  .ss-tagline { transform: translateY(-14dvh); }                 /* closer to the logo above it */
  .ss-btn { font-size: clamp(22px, 2.5vw, 36px); transform: translateY(1dvh); }
  .ss-cell1 { translate: -1.4vw 0; }                             /* characters a little further from the centre */
  .ss-cell2 { translate: 1.4vw 0; }
  .ss-star {
    display: block;
    position: absolute;
    z-index: -1;
    left: 50%;
    top: 50%;
    width: min(70dvh, 46vw);
    height: auto;
    transform: translate(-50%, -50%);
    opacity: .1;
    pointer-events: none;
  }

  /* Gameplay: larger secondary logo; the right-hand block (logo + three lines) is centred vertically
     in the visible screen as one unit (board top offset + half the viewport height). */
  .top-zone {
    top: calc(var(--cy) + 50dvh);
    transform: translateY(-50%);
  }

  /* Transition, Victory and Game Over screens: smaller text, higher up, more room for the image */
  .end-title { font-size: clamp(32px, 5.2vw, 66px); }
  .end-text { font-size: clamp(16px, 2.1vw, 28px); }
  .level-screen, .win-screen, .lose-screen { padding-top: max(14px, 4dvh); }

  /* Secondary logo also on the transition, Victory and Game Over screens */
  body[data-screen="level2"] .amch-logo, body[data-screen="level3"] .amch-logo,
  body[data-screen="win"] .amch-logo, body[data-screen="lose"] .amch-logo { display: block; z-index: 25; }

  /* Level 3: the man a bit larger (the text line above him is shorter than the reserved two lines) */
  #level3Screen .level-img .crop { transform: scale(1.12); transform-origin: 50% 100%; }
}
