/* Fuzzball Ladder screens. Layout only: colours, borders and fonts come from the skin. */

/* ---------- stage overlay ---------- */
.stage { cursor: default; }
.opp-pill { flex-direction: column; align-items: flex-start; gap: 1px; max-width: 62%; white-space: normal; }
.opp-pill b { font-size: var(--fs-sm); }
.opp-pill small, .score-pill small { font-size: var(--fs-xs); opacity: .85; }
.score-pill { flex-direction: column; align-items: flex-end; gap: 1px; }
.score-pill b { font-size: var(--fs-lg); }
.lives { display: inline-flex; gap: 2px; }
.lives .spr { width: 16px; height: 16px; }
.lives .spr.gone { opacity: .25; }
.stage-btn.small { padding: 4px 12px; min-width: 56px; }
.perk-btn { animation: perk-pulse 1s steps(2) infinite; }
@keyframes perk-pulse { 50% { transform: translateY(-3px); } }

/* ---------- upgrade list: one line per stat, two ways to pay ---------- */
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.group-head h2 { margin: 0; font-size: var(--fs-md); color: var(--accent); }
.group-head small { font-size: var(--fs-xs); color: var(--ink-soft); }
.up-row { gap: 8px; padding: 7px; min-height: 0; }
.up-row .row-icon, .up-row .row-icon .spr { width: 32px; height: 32px; }
.up-row .row-sub { font-size: var(--fs-xs); }
.up-btns { display: flex; gap: 2px; flex: none; }
.up-btns .btn { min-width: 70px; padding: 5px 4px; }
.up-btns .btn-label { font-size: var(--fs-xs); }

/* ---------- training plan ---------- */
.plan-row { gap: 8px; padding: 6px 8px; min-height: 0; }
.plan-row .row-main { display: flex; align-items: center; gap: 8px; }
.plan-row .rank { color: var(--accent); min-width: 22px; }
.plan-row .btn { min-width: 46px; padding: 4px; }
.plan-row.skipped .row-title { opacity: .5; }
.plan-row .row-title { white-space: normal; overflow: visible; line-height: 1.15; }   /* two-word names wrap on narrow phones instead of being cut off */
.plan-row .row-main { min-width: 0; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.switches .btn { min-width: 0; white-space: normal; }

/* ---------- perk choice ---------- */
.perk-list { display: flex; flex-direction: column; gap: 8px; }
.perk-card { width: calc(100% - var(--u) * 2); min-height: 56px; white-space: normal; text-align: center; }
.perk-card small { font-size: var(--fs-sm); opacity: .9; }
.perk-card.tradeoff b::after { content: " (trade-off)"; font-size: var(--fs-xs); opacity: .8; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags .chip { margin: 0; }

/* ---------- End run: in the Run tab and on the start menu during a run, never on the court ---------- */
#end-run { margin-top: 12px; }
#end-run-note { margin-top: 6px; }
.menu-end { flex: none; }
.menu-end small { font-size: var(--fs-xs); opacity: .9; white-space: normal; }

@media (max-width: 400px) { .up-btns .btn { min-width: 62px; } }

/* ---------- round 2: pace stepper, settings rows, trophy-shop lock, developer mode ---------- */
.stepper { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.stepper .btn { min-width: 48px; min-height: var(--tap); padding: 0 8px; }
.stepper b { min-width: 64px; text-align: center; font-size: var(--fs-md); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.setting-row .seg { margin: 0; }
.menu-lock { display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 8px; font-size: var(--fs-sm); color: var(--accent); background: var(--panel); box-shadow: var(--edge); }
.menu-lock .spr { flex: none; width: 16px; height: 16px; }
.dev-tag { flex: none; padding: 3px 8px; font-size: var(--fs-xs); letter-spacing: 1px; color: #fff; background: #d9455f; box-shadow: 0 0 0 2px #161a2b; white-space: nowrap; }
.dev-mode #chip-dev { color: #fff; background: #d9455f; }

/* ---------- opponent counter: its own line under the top bar ---------- */
.hud { flex-wrap: wrap; row-gap: 4px; }
/* The top row holds the coins, three chips (trophies, Wildcards, lives) and two buttons. The coin block starts from no
   width and takes what is left, so growing numbers can never push a button onto a second line and move the court. */
.hud-main { flex: 1 1 0; overflow: hidden; }
.hud-nums { overflow: hidden; }
/* On a phone the top bar has no room for a third chip beside the coins. The Wildcard count is on the start menu,
   in Labs, on the Cards screen and on the Wildcards screen; the court ball shows what it pays when it is tapped. */
@media (max-width: 480px) {
  #chip-wildcards { display: none; }
}
@media (max-width: 400px) {
  .hud { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .hud-main { gap: 2px; }
  .hud-coin { width: 26px; }
  .hud-chips { gap: 0; }
  .hud-chips .chip { padding: 4px 4px; gap: 2px; margin: 0 1px; }
}
.ladder-bar { flex: 0 0 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; padding: 0 2px; }
.ladder-bar b { font-size: var(--fs-lg); color: var(--accent); white-space: nowrap; }
.ladder-bar span { font-size: var(--fs-sm); color: var(--ink-soft); white-space: nowrap; }
.ladder-bar span.record { color: var(--accent); }

/* ---------- labs: the research button with its auto-queue switch underneath ---------- */
.lab-row { align-items: flex-start; }
.lab-btns { display: flex; flex-direction: column; gap: 4px; flex: none; width: 96px; }
.lab-btns .btn { width: 100%; min-width: 0; min-height: var(--tap); }
.lab-btns .lab-auto { padding: 2px 4px; font-size: var(--fs-sm); white-space: nowrap; }
.lab-group { margin: 10px 2px 4px; }

/* ---------- unlockable upgrades: 30 rows in three groups, locked ones at the bottom of each group ---------- */
.up-group > * + * { margin-top: var(--gap); }
.menu-list .up-group, .menu-list .group-head { flex: none; }
.row-lock { position: absolute; left: -4px; top: -4px; width: 18px; height: 18px; }
.row-lock .spr { width: 18px; height: 18px; }
.up-row.locked { opacity: .7; }
.up-row.locked .row-icon > .spr { filter: grayscale(1); opacity: .6; }
.up-row .row-sub { white-space: normal; }
.up-btns .btn.hidden { display: none; }

/* Wildcard ball: crosses the court once, tap it for Wildcards */
.wild-ball { position: absolute; left: 0; top: 38%; width: 56px; height: 56px; margin: 0; padding: 0; border: 0; background: transparent; z-index: 6; animation: wild-cross var(--cross, 7s) linear forwards; touch-action: manipulation; }
.wild-ball canvas, .wild-ball svg { width: 100%; height: 100%; image-rendering: pixelated; filter: drop-shadow(0 0 6px #ffd447); }
@keyframes wild-cross { from { transform: translateX(-70px) translateY(0); } 50% { transform: translateX(calc(var(--w, 400px) * .5)) translateY(-26px); } to { transform: translateX(calc(var(--w, 400px) + 20px)) translateY(0); } }
.wild-pop { position: absolute; z-index: 7; font-weight: 700; color: #ffd447; text-shadow: 0 1px 0 #161a2b; pointer-events: none; animation: wild-pop 1.1s ease-out forwards; }
@keyframes wild-pop { to { transform: translateY(-40px); opacity: 0; } }

/* ---------- cards: the card screen on the start menu ---------- */
/* four entries on the start menu (Trophy shop, Labs, Cards, Wildcards): two rows of two */
.menu-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card-shop { flex: none; }
.card-buys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-buys .btn { min-width: 0; min-height: var(--tap); }
.card-shop .note { margin-top: 8px; }
.card-shop #card-dev-grant { margin-top: 8px; }
.card-slots { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.card-slot { min-width: 0; min-height: 52px; padding: 4px; white-space: normal; text-align: center; line-height: 1.1; }
.card-slot b { font-size: var(--fs-xs); }
.card-slot small { font-size: var(--fs-xs); opacity: .85; }
.card-row { gap: 8px; padding: 7px; min-height: 0; align-items: flex-start; }
.card-row .row-icon, .card-row .row-icon .spr { width: 32px; height: 32px; }
.card-row .row-sub { font-size: var(--fs-xs); white-space: normal; }
.card-row .card-copies { color: var(--accent); }
.card-row .btn { flex: none; min-width: 76px; min-height: var(--tap); align-self: center; }
.card-row.rare .row-icon, .card-slot.full.rare { box-shadow: 0 0 0 2px #4aa3df; }
.card-row.epic .row-icon, .card-slot.full.epic { box-shadow: 0 0 0 2px #c77dff; }
@media (max-width: 400px) {
  .menu-entry { min-height: 64px; padding: 6px 4px; }
  .menu-entry > span { font-size: var(--fs-sm); white-space: nowrap; }
  .menu-entry .spr { width: 24px; height: 24px; }
}
