/* barnyard.css, continued (part 2 of 2; index.html loads the parts in order). */
/* columns do not grow with the number: it shrinks instead (fitText) */
#scr-rank .final-stats .fs {
  min-width: 0;
}
#scr-rank .final-stats b {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
#scr-rank .final-stats b svg,
#scr-rank .final-stats b .coin {
  flex: none;
}
#scr-rank .final-stats .fs.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  padding: 8px 8px 10px;
}
#scr-rank .final-stats .fs.wide b {
  font-size: 26px;
}
#scr-rank .final-stats .fs.wide .coin {
  width: 26px;
  height: 26px;
}
#scr-rank .rank-list {
  max-height: min(24vh, 200px);
}
.missions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.missions h3 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 900;
  color: var(--cream);
  -webkit-text-stroke: 3px var(--brown);
  paint-order: stroke fill;
}
.mission {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  align-items: center;
  padding: 9px 18px 12px;
  color: var(--cream);
  font-weight: 800;
  font-size: 14px;
  background: url(./assets/art/row-plaque.webp) center / 100% 100% no-repeat;
}
.mission .txt {
  grid-column: 1;
  line-height: 1.15;
}
.mission .prize {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 900;
  color: var(--gold);
  -webkit-text-stroke: 2.8px var(--brown);
  paint-order: stroke fill;
}
.mission .prize .coin {
  width: 21px;
  height: 21px;
}
.mission .bar {
  grid-column: 1;
  position: relative;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #2b1408;
  box-shadow: inset 0 0 0 1.5px #1b0b03;
}
.mission .bar i {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  min-width: 4px;
  max-width: calc(100% - 4px);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff0a0, #ffc62e 45%, #f0900f);
}
.mission .bar b {
  position: relative;
  display: block;
  text-align: center;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--cream);
  -webkit-text-stroke: 2.2px var(--brown);
  paint-order: stroke fill;
}

/* ---------- levels screen: the two free modes and each chapter's boss ---------- */
.modes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(6px, 1.8vw, 12px);
  margin: 2px 0 2px;
}
.mode {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 76px;
  padding: 8px 12px 11px 10px;
  text-align: left;
  color: var(--cream);
  background: url(./assets/art/btn-wood.webp) center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 3px rgba(40, 16, 4, 0.4));
  transition: transform 0.1s ease;
  animation: rise 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.mode img {
  flex: none;
  width: 50px;
  height: 50px;
  object-fit: contain;
}
.mode span,
.boss-tile span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}
.mode b {
  font-size: 16px;
  font-weight: 900;
  -webkit-text-stroke: 3px var(--brown);
  paint-order: stroke fill;
}
.mode small,
.boss-tile small {
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffe2a8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mode:hover,
.boss-tile:not(.locked):hover {
  filter: brightness(1.1) drop-shadow(0 3px 3px rgba(40, 16, 4, 0.4));
}
.mode:active,
.boss-tile:active {
  transform: scale(0.97);
}
.mode.done {
  filter: drop-shadow(0 0 6px rgba(255, 214, 120, 0.9)) drop-shadow(0 3px 3px rgba(40, 16, 4, 0.4));
}
.boss-tile {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  margin-top: 2px;
  padding: 6px 22px 9px 12px;
  text-align: left;
  color: var(--cream);
  background: url(./assets/art/row-plaque.webp) center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 3px rgba(40, 16, 4, 0.4));
  transition: transform 0.1s ease;
  animation: rise 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
  animation-delay: calc(var(--i) * 25ms);
}
.boss-tile img {
  flex: none;
  width: 96px;
  height: 64px;
  margin: -8px 0;
  object-fit: contain;
}
.boss-tile span {
  flex: 1;
}
.boss-tile b {
  font-size: 18px;
  font-weight: 900;
  -webkit-text-stroke: 3.2px var(--brown);
  paint-order: stroke fill;
}
.boss-tile small {
  font-size: 12.5px;
}
.boss-tile .lock {
  flex: none;
  width: 26px;
  height: 30px;
  color: transparent;
  background: url(./assets/art/icon-lock.webp) center / contain no-repeat;
}
.boss-tile .lock use {
  display: none;
}
.boss-tile .ok {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--gold);
  filter: drop-shadow(0 1.5px 0 var(--brown)) drop-shadow(0 0 1px var(--brown));
}
.boss-tile.locked {
  filter: grayscale(0.7) brightness(0.74) drop-shadow(0 3px 3px rgba(40, 16, 4, 0.4));
}
.boss-tile.locked img {
  filter: brightness(0.2);
} /* locked: silhouette only */
.boss-tile.done {
  filter: drop-shadow(0 0 5px rgba(255, 214, 120, 0.7)) drop-shadow(0 3px 3px rgba(40, 16, 4, 0.4));
}

/* ---------- HUD for special levels: no stars or goal ---------- */
.hud.special .star-meter,
.hud.special .star-legend {
  display: none;
}
.hud.special:not(.landscape) #hud-par {
  font-size: 14.5px;
  margin-top: 2px;
}
.hud.special .lvl-badge b {
  font-size: 21px;
}

/* ---------- reacting chicken ---------- */
/* pose set by the data-parrot attribute on #hud (idle, cheer, scared); the parrot-go class restarts the motion */
.hud-brand .brand-parrot {
  position: absolute;
  left: 2px;
  top: 6px;
  z-index: 2;
  width: 74px;
  height: 74px;
  background: url(./assets/art/parrot-perch.webp) center bottom / contain no-repeat;
  filter: drop-shadow(0 3px 3px rgba(20, 8, 0, 0.4));
  transform-origin: 50% 100%;
}
.hud[data-parrot='cheer'] .brand-parrot,
.hud.landscape[data-parrot='cheer'] .hud-panel.a::before {
  background-image: url(./assets/art/parrot-cheer.webp);
}
.hud[data-parrot='scared'] .brand-parrot,
.hud.landscape[data-parrot='scared'] .hud-panel.a::before {
  background-image: url(./assets/art/parrot-scared.webp);
}
.hud.landscape .hud-panel.a::before {
  transform-origin: 50% 100%;
  background-position: center bottom;
}
.hud.parrot-go[data-parrot='cheer'] .brand-parrot,
.hud.landscape.parrot-go[data-parrot='cheer'] .hud-panel.a::before {
  animation: parrotCheer 0.7s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.hud.parrot-go[data-parrot='scared'] .brand-parrot,
.hud.landscape.parrot-go[data-parrot='scared'] .hud-panel.a::before {
  animation: parrotScared 0.5s ease-out;
}
@keyframes parrotCheer {
  0% {
    transform: translateY(0) scale(1);
  }
  25% {
    transform: translateY(-9px) scale(1.06, 0.96);
  }
  50% {
    transform: translateY(0) scale(0.97, 1.04);
  }
  70% {
    transform: translateY(-5px);
  }
  100% {
    transform: none;
  }
}
@keyframes parrotScared {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px) scale(0.97, 1.03);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(1px);
  }
  100% {
    transform: none;
  }
}
/* the other poses are preloaded (switching does not flicker) */
.hud::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  background-image: url(./assets/art/parrot-cheer.webp), url(./assets/art/parrot-scared.webp);
}
html.reduced .hud .brand-parrot,
html.reduced .hud .hud-panel.a::before {
  animation: none !important;
}

/* sheet header with two badges (coins and stars): fits on narrow phones */
.sheet-head {
  gap: 8px;
}
.sheet-head h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-stars {
  flex: none;
  gap: 5px;
  font-size: 16px;
  padding: 5px 13px 7px;
}
@media (max-width: 460px) {
  .sheet-head,
  #scr-levels .sheet-head {
    padding-left: 12px;
    padding-right: 14px;
  }
  .sheet-head h2 {
    font-size: 23px;
    -webkit-text-stroke-width: 3.8px;
  }
  .sheet-stars {
    font-size: 14px;
    padding: 5px 10px 7px;
  }
  .sheet-stars svg,
  .sheet-stars .coin {
    width: 17px;
    height: 17px;
  }
}
.res-stats small {
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
}

/* ---------- layout fixes ---------- */
/* mode cards: one per row on phones (side by side the text got cut off) */
@media (max-width: 560px) {
  .modes {
    grid-template-columns: 1fr;
  }
  .mode {
    min-height: 68px;
  }
  .mode small {
    -webkit-line-clamp: 2;
    font-size: 12.5px;
  }
}
/* result: labels share the same height (a two-line label does not push its number below the neighbours) */
.res-stats small {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.3em;
}
/* result with "retry" highlighted: stacked buttons */
.results.stack .row {
  flex-direction: column;
}
/* skins: "New!" badge in the card corner, outside the ball window */
.skin .new-badge {
  top: -9px;
  left: -8px;
  z-index: 3;
  clip-path: none;
  border-radius: 7px;
  padding: 3px 9px 4px;
  color: var(--cream);
  font-weight: 900;
  -webkit-text-stroke: 2.4px #5a0d08;
  paint-order: stroke fill;
  background: #c8321f;
  box-shadow:
    0 0 0 2px #5a0d08,
    0 2px 3px rgba(20, 8, 0, 0.5);
}
/* my score: ranks in the same color; only the first one in gold */
.rank-row:nth-child(n) .pos {
  color: #f3dcb4;
}
.rank-row:nth-child(1) .pos {
  color: var(--gold);
}
/* desktop: the chicken stays inside the card (not clipped by the window edge) */
.hud.landscape .hud-panel.a::before {
  top: 4px;
  right: 12px;
  width: 74px;
  height: 74px;
}
/* desktop, special levels: missions take the place of the star ladder */
.hud.special.landscape .star-legend {
  display: grid;
}
.hud.landscape .star-legend .lg-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--cream);
  -webkit-text-stroke: 3px var(--brown);
  paint-order: stroke fill;
}
.hud.landscape .star-legend .lg.ms {
  height: auto;
  min-height: 54px;
  padding: 9px 18px 11px;
  gap: 10px;
  font-size: 13px;
  line-height: 1.15;
}
.hud.landscape .star-legend .lg.ms span {
  min-width: 0;
}
.hud.landscape .star-legend .lg.ms b {
  color: var(--gold);
  font-weight: 900;
  font-size: 15px;
  -webkit-text-stroke: 2.6px var(--brown);
  paint-order: stroke fill;
  white-space: nowrap;
}
.hud.special.landscape #hud-par {
  font-size: 17px;
  font-weight: 900;
  color: var(--gold);
  -webkit-text-stroke: 3px var(--brown);
  paint-order: stroke fill;
}

/* ---------- more layout fixes ---------- */
/* result chicken: cheering (win), waving the little flag (lose) or calm (run over without a new record) */
.res-parrot.calm {
  display: none;
  top: -84px;
  width: 104px;
  margin-left: -52px;
  animation: parrotUp 0.5s ease 0.15s both;
}
.results.calm .res-parrot.win {
  display: none;
}
.results.calm .res-parrot.calm {
  display: block;
}
/* empty progress bars: no gold sliver at zero */
.mission .bar i[hidden],
.skin .need i[hidden] {
  display: none;
}
/* skins: unlock text with room above the bar */
.skin.locked small {
  font-size: 12px;
  line-height: 1.15;
  margin-bottom: 3px;
}

/* ---------- more layout fixes ---------- */
/* skins: same-size buttons on the cards */
.skin .btn,
.skin .in-use {
  width: 100%;
  min-height: 44px;
}
/* stars on level cards slightly larger */
.lvl .stars svg {
  width: clamp(13px, 3.8vw, 20px);
  height: clamp(13px, 3.8vw, 20px);
}

/* ---------- gameplay: star milestones and cannon upgrades ---------- */
.level-grid > .milestone {
  grid-column: 1 / -1;
}
.skin-grid > .up-title {
  grid-column: 1 / -1;
  margin: 6px 0 -2px;
  font-size: 20px;
  font-weight: 900;
  color: var(--cream);
  -webkit-text-stroke: 3.2px var(--brown);
  paint-order: stroke fill;
}
.skin-grid > .up-title:first-child {
  margin-top: 0;
}
.skin.upg img {
  display: block;
  height: 78px;
  width: auto;
  max-width: 100%;
  margin: 4px auto 2px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(10, 4, 0, 0.55));
}
.skin.upg small {
  min-height: 2.3em;
  line-height: 1.15;
}
.skin .pips {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 2px 0 4px;
}
.skin .pips i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2b1408;
  box-shadow:
    inset 0 0 0 2px #1b0b03,
    0 1px 0 rgba(255, 230, 170, 0.25);
}
.skin .pips i.on {
  background: radial-gradient(circle at 35% 30%, #fff3b0, #ffc62e 55%, #e08a0c);
  box-shadow:
    inset 0 0 0 1.5px #7a3d08,
    0 0 5px rgba(255, 205, 90, 0.8);
}
@media (min-width: 720px) {
  .skin-grid:has(.upg) {
    grid-template-columns: repeat(3, 1fr);
    width: min(760px, 100%);
  }
}
/* phone: each upgrade becomes a strip (icon, name and price on one line) and the skins appear earlier */
@media (max-width: 719px) {
  .skin.upg {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 112px;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    text-align: left;
  }
  .skin.upg img {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 58px;
    margin: 0 auto;
  }
  .skin.upg b {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 18px;
  }
  .skin.upg small {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    min-height: 0;
  }
  .skin.upg .pips {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    align-self: end;
  }
  .skin.upg .btn,
  .skin.upg .in-use {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
  }
  .skin.upg b,
  .skin.upg small {
    text-align: left;
  }
}
/* result note (star milestone, missed by 1 volley, day streak): in place of the next-skin bar */
.results .res-note {
  margin: 0;
  padding: 6px 10px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
  text-align: center;
}

/* "Tap to start": the farm glove instead of the line icon (the tap gesture is the existing animation) */
.screen.title.splash .tap-start .tap-hand {
  width: calc(var(--u) * 44);
  height: auto;
  margin: calc(var(--u) * -8) 0 calc(var(--u) * -4);
  filter: drop-shadow(0 calc(var(--u) * 3) calc(var(--u) * 2) rgba(30, 10, 0, 0.6));
  animation: tapFinger 1.3s ease-in-out infinite;
  transform-origin: 50% 100%;
}
@media (prefers-reduced-motion: reduce) {
  .screen.title.splash .tap-start .tap-hand {
    animation: none;
  }
}

/* ================= levels screen: treasure map =================
   Rule for this screen: no art is stretched. Map scenes, sign, tag, pin, barrels and side props keep the file's
   aspect ratio; on wooden plates that change width only the plain center stretches (9-slice in a ::before). */
#scr-levels.map {
  --sheet-pad: calc(14px + var(--sat));
  --map-w: calc(min(1320px, 78vw) / var(--ui-z, 1));
  --sky-h: calc(clamp(270px, 26vw, 520px) / var(--ui-z, 1));
  gap: 0;
  background: #15447c url(./assets/art/map-sea.webp) center top / 1024px auto repeat local;
}
#scr-levels.map .mp-sky {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--sky-h);
  background: url(./assets/art/map-sky.webp) 74% bottom / cover no-repeat;
  -webkit-mask-image: linear-gradient(#000 78%, transparent);
  mask-image: linear-gradient(#000 78%, transparent);
  pointer-events: none;
}
#scr-levels.map > .sheet-head,
#scr-levels.map > .level-grid {
  position: relative;
  z-index: 1;
}
#scr-levels.map > .sheet-head {
  position: sticky;
  z-index: 4;
  width: min(100%, calc(var(--map-w) * 0.81));
  margin-bottom: 8px;
}

/* 9-slice wooden plates: corners with rivets and brackets keep their size; only the center stretches */
#scr-levels.map .sheet-head,
#scr-levels.map .mode,
#scr-levels.map .milestone,
#scr-levels.map .boss-tile {
  background: none;
  isolation: isolate;
}
#scr-levels.map .mode,
#scr-levels.map .milestone,
#scr-levels.map .boss-tile {
  position: relative;
}
#scr-levels.map .sheet-stars {
  position: relative;
  isolation: isolate;
  background: none;
}
#scr-levels.map .sheet-head::before,
#scr-levels.map .mode::before,
#scr-levels.map .milestone::before,
#scr-levels.map .boss-tile::before,
#scr-levels.map .sheet-stars::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-color: transparent;
  pointer-events: none;
}
#scr-levels.map .sheet-stars::before {
  border-width: 14px;
  border-image: url(./assets/art/label.webp) 38 fill / 14px stretch;
}
#scr-levels.map .sheet-head::before {
  border-width: 25px;
  border-image: url(./assets/art/hud-panel.webp) 76 fill / 25px stretch;
}
#scr-levels.map .mode::before {
  border-width: 30px 15px;
  border-image: url(./assets/art/btn-wood.webp) 124 62 fill / 30px 15px stretch;
}
#scr-levels.map .milestone::before,
#scr-levels.map .boss-tile::before {
  border-width: 23px;
  border-image: url(./assets/art/row-plaque.webp) 44 fill / 23px stretch;
}

#scr-levels.map .level-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, var(--map-w));
  gap: 0;
  padding-bottom: 56px;
  container: mapgrid / inline-size;
}
#scr-levels.map .modes {
  width: 72%;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0;
}
#scr-levels.map .mode img {
  width: 54px;
  height: 54px;
  margin: -6px 0;
}
#scr-levels.map .mode {
  min-height: 56px;
  padding: 4px 16px 6px 12px;
  animation: none;
}
#scr-levels.map .mode b {
  font-size: 21px;
  line-height: 1.05;
}
#scr-levels.map .mode small {
  margin-top: 1px;
  font-size: 14.5px;
}
#scr-levels.map .milestone {
  width: 75%;
  margin-top: 6px;
  padding: 5px 20px 8px;
}
#scr-levels.map .milestone .txt {
  font-size: 17.5px;
}
#scr-levels.map .milestone .prize {
  font-size: 27px;
  gap: 6px;
}
#scr-levels.map .milestone .prize .coin {
  width: 30px;
  height: 30px;
}
#scr-levels.map .milestone .bar {
  height: 23px;
  border-radius: 12px;
}
#scr-levels.map .milestone .bar i {
  border-radius: 10px;
}
#scr-levels.map .milestone .bar b {
  font-size: 15px;
  line-height: 23px;
}
#scr-levels.map .sheet-stars svg,
#scr-levels.map .sheet-stars .coin {
  width: 24px;
  height: 24px;
}
#scr-levels.map .sheet-head h2 {
  font-size: 33px;
}
#scr-levels.map .sheet-stars {
  font-size: 21px;
}

/* chapter: sign, map scene and boss */
.mp-ch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: clamp(6px, 0.8cqw, 12px);
  animation: rise 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
.mp-sign {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2cqw;
  width: 70%;
  aspect-ratio: 1400 / 117;
  margin: 0 0 -1.9%;
  padding: 0.4% 3.2% 0 4.2%;
  background: url(./assets/art/map-sign.webp) center / contain no-repeat;
  container-type: inline-size;
  filter: drop-shadow(0 4px 4px rgba(20, 8, 0, 0.45));
}
.mp-sign b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-top: 0.2cqw;
  font-size: 4.1cqw;
  line-height: 1.15;
  font-weight: 900;
  color: var(--cream);
  -webkit-text-stroke: 0.5cqw var(--brown);
  paint-order: stroke fill;
}
.mp-sign em {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  padding-top: 0.2cqw;
  font-style: normal;
  font-size: 3.6cqw;
  font-weight: 900;
  color: var(--gold);
  -webkit-text-stroke: 0.45cqw var(--brown);
  paint-order: stroke fill;
}
.mp-sign .st {
  width: 3.8cqw;
  aspect-ratio: 320 / 312;
  background: url(./assets/art/star-big.webp) center / contain no-repeat;
}
.mp-tag {
  position: absolute;
  left: 1.2%;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6cqw;
  width: 15.5%;
  aspect-ratio: 360 / 99;
  translate: 0 -62%;
  background: url(./assets/art/map-tag.webp) center / contain no-repeat;
  font-size: 2.1cqw;
  font-weight: 900;
  color: #5a3210;
  white-space: nowrap;
}
.mp-tag .lk {
  width: 2.1cqw;
  aspect-ratio: 127 / 160;
  background: url(./assets/art/icon-lock.webp) center / contain no-repeat;
}
.mp-parrot {
  position: absolute;
  left: -9.5%;
  bottom: 2%;
  z-index: 2;
  width: 13.5%;
  height: auto;
  filter: drop-shadow(0 3px 3px rgba(20, 8, 0, 0.5));
}

.mp-isle {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1680 / 320;
  container-type: inline-size;
}
.mp-isle .art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 5px rgba(6, 20, 50, 0.45));
}
.mp-isle .art.tall,
.mp-route.tall {
  display: none;
}
.mp-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.mp-route path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 28 24;
}
.mp-route .sh {
  stroke: rgba(74, 38, 10, 0.6);
  stroke-width: 16;
}
.mp-route .ln {
  stroke: #fff1c9;
  stroke-width: 10.5;
}

/* barrel for each level: art at its own aspect ratio; number, stars, padlock and pin on top */
.mp-lvl {
  position: absolute;
  left: var(--xw);
  top: var(--yw);
  z-index: 1;
  width: 7.5cqw;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  translate: -50% -50%;
  cursor: pointer;
  transition: scale 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.mp-lvl .brl {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0.5cqw 0.35cqw rgba(20, 8, 0, 0.55));
}
.mp-lvl b {
  position: absolute;
  left: 0;
  right: 0;
  top: 16%;
  text-align: center;
  font-size: 3.7cqw;
  line-height: 1.15;
  font-weight: 900;
  color: var(--cream);
  -webkit-text-stroke: 0.5cqw var(--brown);
  paint-order: stroke fill;
}
.mp-lvl .stars {
  position: absolute;
  left: 50%;
  bottom: -3%;
  display: flex;
  gap: 0.1cqw;
  translate: -50% 0;
}
.mp-lvl .stars i {
  width: 2.45cqw;
  aspect-ratio: 320 / 312;
  background: url(./assets/art/star-empty.webp) center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(30, 12, 0, 0.7));
}
.mp-lvl .stars i.on {
  background-image: url(./assets/art/star-big.webp);
}
.mp-lvl .lk {
  position: absolute;
  left: 50%;
  bottom: -1%;
  width: 2.5cqw;
  aspect-ratio: 127 / 160;
  translate: -50% 0;
  background: url(./assets/art/icon-lock.webp) center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(20, 8, 0, 0.8));
}
.mp-lvl.locked {
  cursor: default;
}
.mp-lvl.locked .brl {
  filter: grayscale(1) brightness(0.6) contrast(1.08) drop-shadow(0 0.5cqw 0.35cqw rgba(20, 8, 0, 0.55));
}
.mp-lvl.locked b {
  color: #d6cdbf;
  -webkit-text-stroke-color: #1c1109;
}
.mp-lvl.current {
  z-index: 2;
}
.mp-lvl.current .brl {
  filter: drop-shadow(0 0 0.9cqw #ffd96a) drop-shadow(0 0 0.4cqw #ffb21a)
    drop-shadow(0 0.5cqw 0.35cqw rgba(20, 8, 0, 0.5));
}
.mp-lvl .pin {
  position: absolute;
  left: 50%;
  bottom: 90%;
  width: 58%;
  height: auto;
  translate: -50% 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(20, 8, 0, 0.5));
  animation: mpPin 1s ease-in-out infinite;
}
@keyframes mpPin {
  50% {
    translate: -50% -12%;
  }
}
.mp-lvl:not(.locked):hover {
  scale: 1.07;
}
.mp-lvl:not(.locked):active {
  scale: 0.95;
}
html.reduced .mp-lvl .pin,
html.reduced .mp-ch {
  animation: none;
}

#scr-levels.map .boss-tile {
  z-index: 2;
  width: 66%;
  min-height: 66px;
  margin: -2% 0 0;
  padding: 5px 30px 8px 14px;
}
#scr-levels.map .boss-tile b {
  font-size: 23.5px;
}
#scr-levels.map .boss-tile small {
  font-size: 16.5px;
}
#scr-levels.map .boss-tile .ok {
  width: 54px;
  height: 54px;
  stroke: currentColor;
  stroke-width: 1.6px;
  filter: drop-shadow(0 2px 0 var(--brown)) drop-shadow(0 -1px 0 var(--brown)) drop-shadow(1.5px 0 0 var(--brown))
    drop-shadow(-1.5px 0 0 var(--brown));
}
#scr-levels.map .boss-tile img {
  width: 118px;
  height: 78px;
  margin: -12px 0 -8px;
}

/* locked chapter: the map scene and sign dim; the tag gets the padlock */
#scr-levels.map .boss-tile.locked img {
  filter: grayscale(1) brightness(0.42);
}
.mp-ch:has(.mp-parrot) {
  margin-top: clamp(30px, 3.6cqw, 50px);
}
.mp-ch.locked .mp-isle .art {
  filter: grayscale(0.9) brightness(0.5) contrast(0.9);
}
.mp-ch.locked .mp-route {
  opacity: 0.4;
}
.mp-ch.locked .mp-sign {
  filter: grayscale(0.75) brightness(0.72) drop-shadow(0 4px 4px rgba(20, 8, 0, 0.45));
}

/* decorative side props (post, lantern, palm tree, crate and barrel): fixed to the window, wide screens only */
/* They stay inside the screen, in a zero-height strip stuck to the top (sticky): this way they pass behind the
   header and the map
   (in a small window they covered the close X) and do not scroll with the list. They bleed 2% outside the window
   on all four sides,
   so the cut edge of the painting never shows. */
#scr-levels.map > #map-sides {
  position: sticky;
  top: 0;
  z-index: 0;
  align-self: stretch;
  flex: none;
  height: 0;
  zoom: 1;
  margin: calc(-16px - var(--sat)) calc(-16px - var(--sar)) 0 calc(-16px - var(--sal));
  pointer-events: none;
}
#map-sides {
  --up: calc(16px + var(--sat));
} /* the sticky strip sits a little below the top of the screen: the pieces move up by that amount */
#map-sides img {
  position: absolute;
  top: calc(-2vh - var(--up));
  height: 104vh;
  width: auto;
  max-width: none;
  pointer-events: none;
}
#map-sides .l {
  left: -2vh;
}
#map-sides .r {
  right: -2vh;
}
@media (max-aspect-ratio: 11/10), (max-width: 900px) {
  #scr-levels.map > #map-sides {
    display: none;
  }
}

/* phones and narrow windows: tall map scene with the barrels in two rows, all at screen width */
@container mapgrid (max-width: 719px) {
  #scr-levels.map .modes {
    width: 100%;
    gap: 8px;
  }
  #scr-levels.map .mode {
    min-height: 62px;
    padding: 7px 6px 9px 7px;
    gap: 5px;
  }
  #scr-levels.map .mode img {
    width: 36px;
    height: 36px;
    margin: 0;
  }
  #scr-levels.map .mode b {
    font-size: 13px;
    letter-spacing: -0.2px;
    -webkit-text-stroke-width: 2.4px;
  }
  #scr-levels.map .mode small {
    font-size: 10px;
    -webkit-line-clamp: 3;
    padding-right: 4px;
  }
  #scr-levels.map .milestone {
    width: 100%;
  }
  .mp-ch {
    margin-top: 20px;
  }
  .mp-ch:first-of-type {
    margin-top: 44px;
  } /* the sunset strip appears between the reward and the first map scene */
  .mp-ch:has(.mp-parrot) {
    margin-top: 15.5cqw;
  } /* the chicken rises 15% of the width above the sign: the gap grows with it (phone and tablet) */
  .mp-route path {
    stroke-dasharray: 26 22;
  }
  .mp-sign {
    width: 90%;
    aspect-ratio: var(--sign-tall-ar, 8);
    margin-bottom: 1.5%;
    padding: 0.5% 4.5% 0 5.5%;
    background-image: url(./assets/art/map-sign-tall.webp);
  }
  .mp-sign b {
    font-size: 6.8cqw;
    padding-top: 0.6cqw;
    -webkit-text-stroke-width: 1cqw;
  }
  .mp-sign em {
    font-size: 5.8cqw;
    padding-top: 0.6cqw;
    -webkit-text-stroke-width: 0.9cqw;
  }
  .mp-sign .st {
    width: 5.6cqw;
  }
  .mp-tag {
    left: 4%;
    width: 27%;
    translate: 0 -42%;
    font-size: 3.3cqw;
  }
  .mp-tag .lk {
    width: 3.6cqw;
  }
  .mp-parrot {
    left: -5%;
    bottom: 52%;
    width: 23%;
  }
  .mp-sign:has(.mp-parrot) .mp-tag {
    left: 19%;
  }
  .mp-isle {
    aspect-ratio: 1040 / 460;
  }
  .mp-isle .art.wide,
  .mp-route.wide {
    display: none;
  }
  .mp-isle .art.tall,
  .mp-route.tall {
    display: block;
  }
  .mp-lvl {
    left: var(--xt);
    top: var(--yt);
    width: 13.6cqw;
  }
  .mp-lvl b {
    font-size: 6.1cqw;
    -webkit-text-stroke-width: 0.95cqw;
  }
  .mp-lvl .stars i {
    width: 4.4cqw;
  }
  .mp-lvl .lk {
    width: 4.6cqw;
  }
  #scr-levels.map .boss-tile {
    width: 94%;
    min-height: 62px;
    margin-top: -3%;
    padding: 5px 20px 8px 10px;
  }
  #scr-levels.map .boss-tile .ok {
    width: 34px;
    height: 34px;
  }
  #scr-levels.map .milestone .bar {
    height: 19px;
  }
  #scr-levels.map .milestone .bar b {
    font-size: 12.5px;
    line-height: 19px;
  }
  #scr-levels.map .milestone .prize .coin {
    width: 25px;
    height: 25px;
  }
  #scr-levels.map .milestone {
    padding: 4px 16px 7px;
    margin-top: 6px;
  }
  #scr-levels.map .milestone .txt {
    font-size: 14.5px;
  }
  #scr-levels.map .milestone .prize {
    font-size: 22px;
  }

  #scr-levels.map .boss-tile b {
    font-size: 17px;
  }
  #scr-levels.map .boss-tile small {
    font-size: 12px;
  }
  #scr-levels.map .boss-tile img {
    width: 86px;
    height: 58px;
    margin: -8px 0 -6px;
  }
}
/* portrait tablet and windows without side props: the map uses the full width */
@media (max-width: 1000px), (max-aspect-ratio: 11/10) {
  #scr-levels.map {
    --map-w: 100%;
  }
  #scr-levels.map > .sheet-head {
    width: 100%;
  }
  #scr-levels.map .sheet-head h2 {
    font-size: 27px;
  }
  #scr-levels.map .sheet-stars {
    font-size: 18px;
  }
}
@media (max-width: 760px) {
  #scr-levels.map {
    --map-w: 100%;
    --sky-h: calc(270px / var(--ui-z, 1));
  }
  #scr-levels.map > .sheet-head {
    width: 100%;
    gap: 6px;
    padding-top: 6px;
    padding-bottom: 8px;
    margin-bottom: 6px;
  }
  #scr-levels.map .sheet-head .icon-btn {
    width: 42px;
    height: 40px;
  }
  #scr-levels.map .sheet-head h2 {
    font-size: 22px;
  }
  #scr-levels.map .sheet-stars {
    font-size: 15px;
    gap: 4px;
    padding: 5px 10px 7px;
  }
}

/* ---------- loading ----------
   This is the title screen itself: same background plate and same logo, in the same place, via the same classes
   (.screen.title,
   .title-wrap, .logo). When the game is ready it fades out and only the bar gives way to "tap to start": the logo
   does not jump.
   The bar is a dark track with a gold rim; the gold fills up and a ball rolls at the tip. */
#loader {
  background-color: #17304f;
}
#loader .ld-bar {
  position: relative;
  width: calc(var(--u) * 236);
  height: calc(var(--u) * 22);
  margin-top: calc(var(--u) * 62);
  border-radius: calc(var(--u) * 11);
  background: #2b1408;
  box-shadow:
    0 0 0 calc(var(--u) * 3) #d9a13a,
    0 0 0 calc(var(--u) * 5.5) var(--brown),
    0 calc(var(--u) * 7) calc(var(--u) * 6) rgba(20, 8, 0, 0.5),
    inset 0 calc(var(--u) * 2) calc(var(--u) * 3) rgba(0, 0, 0, 0.65);
}
#loader .ld-bar i {
  position: absolute;
  left: calc(var(--u) * 2.5);
  top: calc(var(--u) * 2.5);
  bottom: calc(var(--u) * 2.5);
  width: 0;
  min-width: calc(var(--u) * 17);
  max-width: calc(100% - var(--u) * 5);
  border-radius: calc(var(--u) * 9);
  background: linear-gradient(180deg, #fff0a0, #ffc62e 45%, #f0900f);
  box-shadow: inset 0 calc(var(--u) * 1) 0 rgba(255, 255, 255, 0.55);
  transition: width 0.25s ease;
}
#loader .ld-bar i::after {
  content: '';
  position: absolute;
  right: calc(var(--u) * -15);
  top: 50%;
  width: calc(var(--u) * 34);
  aspect-ratio: 125 / 128;
  translate: 0 -50%;
  background: url(./assets/art/ball-spark.webp) center / contain no-repeat;
  filter: drop-shadow(0 calc(var(--u) * 2) calc(var(--u) * 2) rgba(20, 8, 0, 0.6));
  animation: ldRoll 0.9s linear infinite;
}
@keyframes ldRoll {
  to {
    rotate: 360deg;
  }
}
html.reduced #loader .ld-bar i::after {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  #loader .ld-bar i::after {
    animation: none;
  }
}

/* chapter name in the HUD: golden cream with an outline (an accent color like purple or blue disappeared against
   the wood) */
.lvl-cap {
  color: #ffe2a8;
  font-weight: 800;
  -webkit-text-stroke: 2.4px var(--brown);
  paint-order: stroke fill;
}

/* short notice (not enough coins, mission complete): a single line, never wrapping over the title on phones */
.toast {
  white-space: nowrap;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* chicken perch on the desktop panel: a wooden peg fixed to the panel edge, under its feet */
.hud-perch {
  display: none;
}
.hud.landscape:not(.tight) .hud-perch {
  display: block;
  position: absolute;
  right: -9px;
  top: 33px;
  z-index: 1;
  width: 104px;
  aspect-ratio: 1180 / 520;
  background: url(./assets/art/hud-perch.webp) center / contain no-repeat;
  filter: drop-shadow(0 3px 3px rgba(20, 8, 0, 0.5));
  pointer-events: none;
}

/* sheet-screen header (levels, skins): only the plain wood center stretches; the riveted corners keep their size
   (stretching the whole plate deformed the corners). Same for the number tags. */
.sheet-head,
.sheet-stars {
  position: relative;
  isolation: isolate;
  background: none;
}
#scr-levels .sheet-head {
  position: sticky;
  background: none;
}
.sheet-head::before,
.sheet-stars::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-color: transparent;
  pointer-events: none;
}
.sheet-head::before {
  border-width: 25px;
  border-image: url(./assets/art/hud-panel.webp) 76 fill / 25px stretch;
}
.sheet-stars::before {
  border-width: 14px;
  border-image: url(./assets/art/label.webp) 38 fill / 14px stretch;
}

/* ---------- living lanterns and logo shine ----------
   Presentation only: a warm glow breathing over each painted lantern and five fireflies drifting around.
   The position follows each screen's background plate (same scale math as the background). */
.lamp-fx {
  position: absolute;
  z-index: 1;
  width: 0;
  height: 0;
  pointer-events: none;
  --s: 1px;
}
.lamp-fx b {
  position: absolute;
  left: calc(var(--s) * -70);
  top: calc(var(--s) * -70);
  width: calc(var(--s) * 140);
  height: calc(var(--s) * 140);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 220, 140, 0.75),
    rgba(255, 170, 70, 0.3) 38%,
    rgba(255, 150, 40, 0) 70%
  );
  mix-blend-mode: screen;
  animation: lampFlick 2.9s ease-in-out infinite;
}
.lamp-fx i {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--s) * 7);
  height: calc(var(--s) * 7);
  margin: calc(var(--s) * -3.5);
  border-radius: 50%;
  background: radial-gradient(circle, #fff8b8, rgba(215, 240, 110, 0.7) 45%, rgba(200, 230, 90, 0) 75%);
  box-shadow: 0 0 calc(var(--s) * 7) rgba(240, 250, 150, 0.9);
  animation:
    fly1 7s ease-in-out infinite,
    flyBlink 1.9s ease-in-out infinite;
}
.lamp-fx i:nth-of-type(2) {
  animation:
    fly2 9s ease-in-out infinite,
    flyBlink 2.6s ease-in-out -0.7s infinite;
}
.lamp-fx i:nth-of-type(3) {
  animation:
    fly3 11s ease-in-out infinite,
    flyBlink 2.2s ease-in-out -1.3s infinite;
}
.lamp-fx i:nth-of-type(4) {
  animation:
    fly1 13s ease-in-out -4s infinite reverse,
    flyBlink 3.1s ease-in-out -0.4s infinite;
}
.lamp-fx i:nth-of-type(5) {
  animation:
    fly2 8s ease-in-out -3s infinite reverse,
    flyBlink 1.7s ease-in-out -1s infinite;
}
@keyframes lampFlick {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(1);
  }
  22% {
    opacity: 1;
    transform: scale(1.07);
  }
  31% {
    opacity: 0.7;
    transform: scale(0.97);
  }
  47% {
    opacity: 0.95;
    transform: scale(1.04);
  }
  68% {
    opacity: 0.74;
    transform: scale(0.98);
  }
  83% {
    opacity: 0.9;
    transform: scale(1.02);
  }
}
@keyframes flyBlink {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 1;
  }
}
@keyframes fly1 {
  0%,
  100% {
    translate: calc(var(--s) * -38) calc(var(--s) * 12);
  }
  25% {
    translate: calc(var(--s) * -10) calc(var(--s) * -44);
  }
  50% {
    translate: calc(var(--s) * 44) calc(var(--s) * -16);
  }
  75% {
    translate: calc(var(--s) * 20) calc(var(--s) * 40);
  }
}
@keyframes fly2 {
  0%,
  100% {
    translate: calc(var(--s) * 34) calc(var(--s) * 30);
  }
  30% {
    translate: calc(var(--s) * 52) calc(var(--s) * -28);
  }
  55% {
    translate: calc(var(--s) * -24) calc(var(--s) * -50);
  }
  80% {
    translate: calc(var(--s) * -48) calc(var(--s) * 22);
  }
}
@keyframes fly3 {
  0%,
  100% {
    translate: calc(var(--s) * -6) calc(var(--s) * 56);
  }
  20% {
    translate: calc(var(--s) * -52) calc(var(--s) * -8);
  }
  50% {
    translate: calc(var(--s) * 8) calc(var(--s) * -60);
  }
  75% {
    translate: calc(var(--s) * 58) calc(var(--s) * 10);
  }
}
html.reduced .lamp-fx i {
  display: none;
}
html.reduced .lamp-fx b {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .lamp-fx i {
    display: none;
  }
  .lamp-fx b {
    animation: none;
  }
}

/* portrait menu: the plate (853 x 1844) fills the full height, centered; the lantern is at (44, 186) on it */
.screen.title > .lamp-fx {
  --s: calc(100cqh / 1844 * 1.5);
  left: calc(50cqw + 100cqh / 1844 * (44 - 426.5));
  top: calc(100cqh / 1844 * 186);
  zoom: 1;
}
/* desktop menu: the plate (1672 x 941) covers the screen, centered; the lantern is at (118, 183) on it */
@media (min-aspect-ratio: 1/1) {
  .screen.title > .lamp-fx {
    --k: max(100cqw / 1672, 100cqh / 941);
    --s: calc(var(--k) * 1.35);
    left: calc(50cqw + var(--k) * (118 - 836));
    top: calc(50cqh + var(--k) * (183 - 470.5));
  }
}
/* map side props: images at window height (419 x 1400 and 444 x 1400); the lantern is at 20.5% of the height */
#map-sides .lamp-fx {
  position: absolute;
  z-index: 1;
  --s: calc(100vh / 760);
  top: calc(104vh * 0.205 - 2vh - var(--up));
}
#map-sides .lamp-fx.l {
  left: calc(104vh * 419 / 1400 * 0.57 - 2vh);
}
#map-sides .lamp-fx.r {
  right: calc(104vh * 444 / 1400 * 0.56 - 2vh);
}

/* logo: sways gently and, every 6 s, a streak of light sweeps across (the light uses the logo itself as a mask) */
.screen.title .logo {
  animation: logoFloat 5.2s ease-in-out infinite;
}
.logo-shine {
  position: absolute;
  left: 50%;
  top: calc(var(--u) * 91);
  width: calc(var(--u) * 382);
  aspect-ratio: 1200 / 850;
  margin-left: calc(var(--u) * -191);
  pointer-events: none;
  -webkit-mask: url(./assets/art/menu-hero.webp) center / contain no-repeat;
  mask: url(./assets/art/menu-hero.webp) center / contain no-repeat;
  background: linear-gradient(
      105deg,
      rgba(255, 255, 255, 0) 42%,
      rgba(255, 250, 220, 0.75) 50%,
      rgba(255, 255, 255, 0) 58%
    )
    no-repeat;
  background-size: 300% 100%;
  mix-blend-mode: screen;
  animation:
    logoShine 6s ease-in-out infinite,
    logoFloat 5.2s ease-in-out infinite;
}
@media (min-aspect-ratio: 1/1) {
  .logo-shine {
    top: calc(var(--u) * 10);
    width: calc(var(--u) * 372);
    margin-left: calc(var(--u) * -186);
  }
}
@keyframes logoShine {
  0%,
  62% {
    background-position: 150% 0;
  }
  85%,
  100% {
    background-position: -50% 0;
  }
}
@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(calc(var(--u) * -3)) rotate(-0.5deg);
  }
}
html.reduced .screen.title .logo,
html.reduced .logo-shine {
  animation: none;
}
html.reduced .logo-shine {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .screen.title .logo {
    animation: none;
  }
  .logo-shine {
    display: none;
  }
}

/* perch slightly lower: the chicken's feet rest on the peg */
.hud.landscape:not(.tight) .hud-perch {
  top: 40px;
}

/* menu buttons: the label never overflows the plate; if a word is long in some language, the text shrinks
   (fitText) */
.title-row .btn span,
.title-actions .btn span {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- layout tweaks ---------- */
/* perch: just the peg with the rope, coming out of the panel edge, with the chicken's feet on it */
.hud.landscape:not(.tight) .hud-perch {
  right: 2px;
  top: 47px;
  width: 84px;
  aspect-ratio: 220 / 129;
}

/* result boxes (volleys, best combo, goal): the number sits in a dark recess, like a dial */
.res-stats div {
  border-width: 8px 8px 10px;
  gap: 3px;
}
.res-stats small {
  color: #ffe9c2;
  font-weight: 900;
  font-size: 11.5px;
  -webkit-text-stroke: 2.2px var(--brown);
  paint-order: stroke fill;
}
.res-stats b {
  align-self: stretch;
  margin: 0 2px;
  padding: 3px 0 4px;
  text-align: center;
  font-size: 24px;
  line-height: 1.05;
  color: var(--gold);
  -webkit-text-stroke: 3.4px #1b0b03;
  border-radius: 8px;
  background: linear-gradient(180deg, #1a0c04, #2e1608);
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1.5px #120701,
    0 1px 0 rgba(255, 214, 150, 0.35);
}

/* star legend on the desktop panel: three slots per row, larger stars, threshold in a dark badge */
.hud.landscape .star-legend {
  gap: 12px;
}
.hud.landscape .star-legend .lg {
  height: 62px;
  padding: 0 14px 2px 16px;
  grid-template-columns: 1fr auto;
}
.hud.landscape .star-legend i {
  gap: 4px;
  align-items: center;
}
.hud.landscape .star-legend .ls {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 2px 1px rgba(30, 12, 0, 0.7));
}
.hud.landscape .star-legend .ls.off {
  background-image: url(./assets/art/star-empty.webp);
  opacity: 0.55;
}
.hud.landscape .star-legend b {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 62px;
  padding: 3px 8px 4px;
  font-size: 21px;
  line-height: 1;
  font-weight: 900;
  color: var(--gold);
  -webkit-text-stroke: 3px #1b0b03;
  paint-order: stroke fill;
  border-radius: 9px;
  background: linear-gradient(180deg, #1a0c04, #2e1608);
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1.5px #120701,
    0 1px 0 rgba(255, 214, 150, 0.35);
  text-align: center;
}
.hud.landscape .star-legend b small {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e9cf9f;
  -webkit-text-stroke: 0;
  margin-bottom: 2px;
}
.hud.landscape .star-legend .lg.now {
  filter: brightness(1.16) drop-shadow(0 0 7px rgba(255, 214, 120, 0.85));
  scale: 1.03;
}
.hud.landscape .star-legend .lg.gone {
  opacity: 1;
  filter: grayscale(0.85) brightness(0.62);
}
.hud.landscape .star-legend .lg.gone b {
  text-decoration: none;
}

/* short window: the menu settings buttons stay at the bottom (overrides an older rule that pushed them up over the
   tagline) */
.screen.title .corner-tools {
  top: auto;
}

/* themed scrollbar: dark wood track and gold thumb (levels, skins, cards) */
.screen.sheet::-webkit-scrollbar,
.card::-webkit-scrollbar,
.rank-list::-webkit-scrollbar {
  width: 14px;
}
.screen.sheet::-webkit-scrollbar-track,
.card::-webkit-scrollbar-track,
.rank-list::-webkit-scrollbar-track {
  background: linear-gradient(90deg, #1b0b03, #3a1c0a 45%, #2a1206);
  box-shadow: inset 0 0 0 1.5px #120701;
}
.screen.sheet::-webkit-scrollbar-thumb,
.card::-webkit-scrollbar-thumb,
.rank-list::-webkit-scrollbar-thumb {
  border: 2.5px solid #2a1206;
  border-radius: 8px;
  background: linear-gradient(90deg, #fff0a0, #ffc62e 45%, #d9820c);
}
.screen.sheet::-webkit-scrollbar-thumb:hover,
.card::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #fff7c4, #ffd75a 45%, #eb9a1a);
}
.screen.sheet::-webkit-scrollbar-button,
.card::-webkit-scrollbar-button {
  display: none;
}
@supports not selector(::-webkit-scrollbar) {
  .screen.sheet,
  .card,
  .rank-list {
    scrollbar-color: #ffc62e #2a1206;
    scrollbar-width: thin;
  }
}
@supports selector(::-webkit-scrollbar) {
  .card {
    scrollbar-width: auto;
  }
}

/* ---------- layout fixes ---------- */
/* desktop panel in a short window: the star legend fits again (the new rows were too tall) */
.hud.landscape.tight .star-legend {
  gap: 5px;
}
.hud.landscape.tight .star-legend .lg {
  height: 34px;
  padding: 0 8px 1px 10px;
}
.hud.landscape.tight .star-legend .ls {
  width: 17px;
  height: 17px;
}
.hud.landscape.tight .star-legend b {
  min-width: 44px;
  padding: 2px 6px 3px;
  font-size: 14px;
  -webkit-text-stroke-width: 2.4px;
  border-radius: 7px;
}
.hud.landscape.tight .star-legend b small {
  display: none;
}
.hud.landscape.tight .star-legend .lg.ms {
  min-height: 34px;
  padding: 4px 10px 5px;
  font-size: 11px;
}
.hud.landscape.tight .star-legend .lg-title {
  font-size: 13px;
}
/* level name: a word that does not fit the line shrinks (fitText) instead of being truncated with an ellipsis */
.hud.landscape .hud-name {
  overflow-wrap: normal;
  word-break: keep-all;
}
.wrap-any {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: normal !important;
  text-overflow: clip !important;
}
/* phone: on the two levels of the bottom row the pin sits in the barrel corner (on top it covered the stars of the
   level above) */
@container mapgrid (max-width: 719px) {
  .mp-lvl.low .pin {
    left: 88%;
    bottom: 46%;
    width: 50%;
  }
}

/* ---------- menu Play button ---------- */
/* one whole image per aspect ratio (portrait 4.09:1, landscape 5.5:1): nothing stretches and there is no slice
   seam on hover */
@media (min-aspect-ratio: 1/1) {
  .title-actions .btn.big.primary {
    background-image: url(./assets/art/btn-play-wide.webp);
  }
}
/* the text clip box gets extra room above and below (descenders and outline) without changing the line height */
.title-row .btn span,
.title-actions .btn span {
  padding: 0.22em 0.14em;
  margin: -0.22em -0.14em;
}

/* ---------- fixes from a full playthrough of Barnyard Boom ---------- */
/* desktop panel hint: in this theme the plaque is dark wood, so the text is light */
.hud.landscape .hud-hint {
  color: var(--cream);
  text-shadow: 0 1px 2px rgba(10, 6, 2, 0.9);
}
/* chapter name on the map: shrinks to fit (fitText) instead of being truncated with an ellipsis */
.mp-sign b {
  text-overflow: clip;
  line-height: 1.4;
}

/* boss card on the map: name on a single line, shrinking to fit, to leave height for the text below */
.boss-tile b {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- text fixes (alignment, clipping and small text) ---------- */
/* notice: no ellipsis; the text shrinks and, as a last resort, wraps to two lines (fitText) */
.toast {
  text-overflow: clip;
  text-align: center;
  line-height: 1.15;
}
/* boss and mode cards on the map: up to 3 lines, shrinking to fit inside the frame (fitColumn) */
.mode small,
.boss-tile small,
#scr-levels.map .mode small {
  -webkit-line-clamp: 3;
}
/* result card title: a single line inside the ribbon, shrinking */
#res-title {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
/* mission: the text stays on one line and shrinks instead of wrapping over the bar */
.mission {
  grid-template-columns: minmax(0, 1fr) auto;
}
.mission .txt {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
/* volleys, best combo and goal labels: all three on a single line (keeps them consistent) */
.res-stats small {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
/* score list: the name shrinks before being clipped */
.rank-row .name {
  text-overflow: clip;
}
/* desktop panel hint: bottom padding so the last line does not touch the frame */
.hud.landscape .hud-hint {
  padding-bottom: 19px;
}
/* tap to start: fits the phone width */
.screen.title.splash .tap-start {
  max-width: 92%;
  font-size: calc(var(--u) * 23);
}
/* score and level name on phones: slightly lower, clear of the top frame */
.hud:not(.landscape) .hud-stat.score {
  padding-top: 7px;
}
.hud:not(.landscape) .lvl-text {
  padding-top: 11px;
}
/* shop header sticks to the top while scrolling (keeps the back button visible) */
#scr-skins .sheet-head {
  position: sticky;
  top: 0;
  z-index: 5;
}
/* levels header on desktop: does not cover the top of the mode cards */
#scr-levels.map > .sheet-head {
  margin-bottom: 16px;
}
/* chapter tag on phones: text at least 10 px */
@container mapgrid (max-width: 719px) {
  .mp-tag {
    font-size: max(10px, 3.3cqw);
  }
}
/* Japanese: lines break between phrases, not mid-word */
html[lang='ja'] body {
  word-break: auto-phrase;
}
/* star reward label (map) and missions label (score): moved down inside the plate, clear of the frame */
#scr-levels.map .milestone {
  padding-top: 12px;
  padding-bottom: 11px;
}
.mission {
  padding-top: 13px;
  padding-bottom: 13px;
}
/* shop: covers the gap above the sticky header (cards showed over it while scrolling) */
#scr-skins .sheet-head::after {
  content: '';
  position: absolute;
  left: -100vw;
  right: -100vw;
  bottom: calc(100% - 4px);
  height: 80px;
  z-index: -1;
  background: #1c0e06;
}

/* mode card on the map: title on a single line, shrinking to fit */
.mode b {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
/* right padding on mode and boss card text: a one-line title does not touch the frame */
.mode span,
.boss-tile span {
  padding-right: 8px;
}

/* result card title: with overflow hidden the ribbon could shrink in height on desktop (it ended up 21 px) */
#res-title {
  flex-shrink: 0;
}

/* boost counter (phone): right after the blocks-left number, before the bar, away from the score (which grows with
   its digits) */
.hud:not(.landscape) .hud-stat.alive .waves {
  order: 1;
  margin: 0 4px;
}
.hud:not(.landscape) .hud-stat.alive .bar {
  order: 2;
}
.hud:not(.landscape) .hud-stat.alive:has(.waves:not([hidden])) {
  grid-template-columns: auto auto auto minmax(0, 1fr);
}

/* phone: the blocks bar is inset by the width of the score number (--score-w, measured in ui.js) */
.hud:not(.landscape) .hud-stat.alive .bar {
  margin-right: calc(var(--score-w, 0px) + 8px);
}
/* desktop: special levels (boss, Endless, Daily) have no chapter strip */
.hud.landscape .hud-panel.a.no-chapter .hud-chapter {
  display: none;
}
/* without room (boosts + 6-digit score) the bar shrinks until it disappears instead of sliding under the score */
.hud:not(.landscape) .hud-stat.alive {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
}
.hud:not(.landscape) .hud-stat.alive .bar {
  min-width: 0;
}

/* mode cards on the map: the two columns never overflow the window (the title shrinks) */
.modes,
#scr-levels.map .modes {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.mode {
  min-width: 0;
}
/* shop: strip above the sticky header only after scrolling */
#scr-skins:not(.scrolled) .sheet-head::after {
  display: none;
}

/* side-by-side buttons on cards (pause, result): share the row evenly and the text shrinks (fitText) */
.card .row .btn {
  flex: 1 1 0;
  min-width: 0;
}
.card .row .btn > span,
#btn-continue > span:first-child {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
#btn-continue {
  max-width: 100%;
}
#btn-continue .chip {
  flex: none;
}

/* End of barnyard-2.css */
