/* ============================================================================
   EPIC 61 FIGHT LAYOUT B, "game HUD strips" (approved Sprint 37).
   Spec: tasks/sprint-37/epic61-sources/layout61/fight-layout-options.html, approach B.
   Every rule is scoped under .fight-b, which CombatPage puts on its root only while
   layout B is on (combat feedback session live). With the switch off nothing here matches.
   The mock sized everything in container units of the whole screen; the battle screen IS
   the whole screen (100dvh x 100vw), so cqh maps to dvh and cqw to vw here.
   ============================================================================ */

.fight-b {
    --fb-fs-name: clamp(11px, 1.9dvh, 19px);
    --fb-name-min: 9px;
    --fb-fs-val: clamp(10px, 1.6dvh, 16px);
    --fb-bar-h: clamp(8px, 1.55dvh, 15px);
    --fb-icon: clamp(16px, 3dvh, 30px);
    --fb-pad: clamp(4px, 0.95dvh, 10px);
    --fb-gap: clamp(3px, 0.6dvh, 7px);
    --fb-edge-y: clamp(5px, 1.2dvh, 14px);
    --fb-edge-x: clamp(6px, 1vw, 16px);
    --fb-card-w: clamp(140px, 21vw, 360px);
    --fb-face: clamp(26px, 5.4dvh, 50px);
    --fb-me-face: clamp(30px, 6.6dvh, 58px);
    --fb-ab: clamp(40px, 8.4dvh, 74px);
    --fb-tick-w: clamp(150px, 20vw, 290px);
    --fb-letter: calc(var(--fb-fs-name) * 1.35);
    /* Height of one HUD card row (name line, bar, status row, padding); the question panel starts below it. */
    --fb-hud-h: calc(var(--fb-pad) * 2 + var(--fb-fs-name) * 1.25 + var(--fb-bar-h) + var(--fb-icon) + var(--fb-gap) * 2 + 2px);
    --fb-panel: rgba(8, 12, 22, 0.78);
    --fb-panel-line: rgba(255, 255, 255, 0.13);
    --fb-hp-foe: linear-gradient(90deg, #ef4444, #dc2626);
    --fb-hp-me: linear-gradient(90deg, #4ade80, #16a34a);
    --fb-shield: linear-gradient(90deg, #6bb5f5, #8ec8f8);
    --fb-gold: #ffd88a;
    --fb-gold-ink: #2b1a00;
    --fb-gold-fill: linear-gradient(#ffe7a3, #f2b544);
    /* Above the question overlay (z-index 60), so both health displays stay readable while it is open. */
    --fb-hud-z: 61;
}

/* CF-10: the kit's layer (.cf-layer, on <body>) sits above the question backdrop and the HUD cards, so
   "Miss", the enemy's number and "Blocked" stay bright while the panel is still up, and a number drops
   into a card's bar on top of the card. The kit's own default (50) is under the backdrop. */
body:has(.fight-b) {
    --cf-z: 62;
}

/* The fight area takes whatever height is left between the top bar and the bottom bar. Today's
   tablet rules give it a 350px floor and a margin, which pushed the bottom bar off a sideways phone. */
.fight-b .asc-battle-arena {
    min-height: 0;
    margin: 0;
}

/* ---------- top HUD: ticker (left) + enemy cards or boss bar (right) ---------- */
.fight-b .fb-hud-top {
    position: absolute;
    top: var(--fb-edge-y);
    left: var(--fb-edge-x);
    right: var(--fb-edge-x);
    z-index: var(--fb-hud-z);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    pointer-events: none;
    font-family: 'Inter', system-ui, sans-serif;
    color: #fff;
    line-height: 1.2;
}

.fight-b .fb-hud-top > * {
    pointer-events: auto;
}

.fight-b .fb-foes {
    display: flex;
    gap: clamp(5px, 0.8vw, 12px);
    margin-left: auto;
    min-width: 0;
}

/* ---------- shared card look ---------- */
.fight-b .fb-card,
.fight-b .fb-boss {
    position: relative;
    box-sizing: border-box;
    background: var(--fb-panel);
    border: 1px solid var(--fb-panel-line);
    border-radius: clamp(6px, 1dvh, 10px);
    padding: var(--fb-pad);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    text-align: left;
    color: #fff;
    transition: box-shadow 0.15s;
}

.fight-b .fb-card--foe {
    flex: 0 1 var(--fb-card-w);
    width: var(--fb-card-w);
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: calc(var(--fb-gap) * 1.4);
    align-items: center;
    cursor: pointer;
}

.fight-b .fb-card--vanished {
    opacity: 0.55;
}

.fight-b .fb-card__stack {
    display: grid;
    gap: var(--fb-gap);
    min-width: 0;
    container-type: inline-size;
}

.fight-b .fb-card__head,
.fight-b .fb-boss__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.fight-b .fb-card__name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 700;
    /* Long names shrink to fit the card instead of being cut off: the room left beside the HP
       figure (about 6 characters of value text, plus the letter chip when shown) divided by the
       name's length (set inline as --fb-name-len), at about 0.6em per bold character. Never below
       the floor; the ellipsis below is only a last resort. */
    font-size: max(var(--fb-name-min), min(var(--fb-fs-name),
        calc((100cqi - var(--fb-fs-val) * 4.2 - var(--fb-name-chip, 0px) - 12px) / (var(--fb-name-len, 10) * 0.6))));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fight-b .fb-card__head:has(.fb-letter) .fb-card__name {
    --fb-name-chip: calc(var(--fb-letter) + 6px);
}

.fight-b .fb-card__name--me {
    color: var(--fb-gold);
}

.fight-b .fb-card__hp {
    flex: none;
    font-size: var(--fb-fs-val);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #dfe4ee;
    white-space: nowrap;
}

.fight-b .fb-shield {
    color: #8ec8f8;
    font-weight: 700;
}

.fight-b .fb-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--fb-gap);
    min-height: var(--fb-icon);
    min-width: 0;
}

/* status badges inside a card: one row, icons shrink rather than wrap, so every card is one height */
.fight-b .fb-card__row .asc-status-icons {
    flex: 0 1 auto;
    min-width: 0;
    margin-top: 0;
    flex-wrap: nowrap;
    gap: calc(var(--fb-gap) * 0.8);
}

.fight-b .fb-card__row .asc-status-icon {
    flex: 0 1 var(--fb-icon);
    width: var(--fb-icon);
    height: auto;
    min-width: 12px;
    aspect-ratio: 1;
}

.fight-b .fb-card__row .asc-status-icon__img {
    width: 100%;
    height: auto;
    display: block;
}

/* turn count hourglass */
.fight-b .fb-tc {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: none;
    font-weight: 700;
    font-size: var(--fb-fs-val);
    color: #ffd27a;
    white-space: nowrap;
}

.fight-b .fb-tc img {
    width: calc(var(--fb-icon) * 0.78);
    height: auto;
    image-rendering: pixelated;
}

.fight-b .fb-tc--now {
    color: #ff7b7b;
}

/* look-alike letter, on the card and under the enemy's feet */
.fight-b .fb-letter,
.fight-b .fb-foot-letter {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--fb-letter);
    height: var(--fb-letter);
    border-radius: 5px;
    background: #f5f0e1;
    color: #1a1a1a;
    font: 700 calc(var(--fb-fs-name) * 0.85) / 1 'Inter', system-ui, sans-serif;
}

.fight-b .asc-tutorial-enemy-character > .fb-foot-letter {
    position: absolute;
    left: 50%;
    bottom: calc(-1 * var(--fb-letter) - clamp(2px, 0.6dvh, 6px));
    transform: translateX(-50%);
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* the enemy's face, cut from its own idle sheet (EnemyPortraitCatalog) */
.fight-b .fb-face {
    position: relative;
    display: block;
    flex: none;
    width: var(--fb-face);
    height: var(--fb-face);
    border-radius: 7px;
    overflow: hidden;
    background: linear-gradient(#2d3d62, #18223a);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.fight-b .fb-face--mirror {
    transform: scaleX(-1);
}

.fight-b .fb-face__sheet {
    position: absolute;
    display: block;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    image-rendering: pixelated;
}

/* health bar */
.fight-b .fb-bar {
    position: relative;
    height: var(--fb-bar-h);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 99px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.fight-b .fb-bar__hp,
.fight-b .fb-bar__shield,
.fight-b .fb-bar__trail {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: block;
}

.fight-b .fb-bar__hp {
    background: var(--fb-hp-foe);
    transition: width 0.25s ease-out;
}

.fight-b .fb-card--me .fb-bar__hp {
    background: var(--fb-hp-me);
}

.fight-b .fb-bar__shield {
    background: var(--fb-shield);
}

.fight-b .fb-bar__trail {
    background: rgba(255, 236, 200, 0.85);
}

/* hit and link states */
.fight-b .fb-card.fb-hit,
.fight-b .fb-boss.fb-hit {
    box-shadow: 0 0 0 2px rgba(255, 110, 110, 0.95), 0 0 16px rgba(255, 70, 70, 0.55);
}

.fight-b .fb-card.fb-linked,
.fight-b .fb-boss.fb-linked {
    box-shadow: 0 0 0 2px var(--fb-gold), 0 0 18px rgba(255, 216, 138, 0.6);
}

.fight-b .asc-tutorial-enemy-character[data-fb-linked] .asc-tutorial-enemy-sprite-container {
    filter: drop-shadow(0 0 0.35dvh #fff6d6) drop-shadow(0 0 1.2dvh rgba(255, 216, 138, 0.9));
}

.fight-b .asc-tutorial-enemy-character[data-fb-linked] > .fb-foot-letter {
    background: var(--fb-gold);
}

/* ---------- boss bar ---------- */
.fight-b .fb-boss {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: min(54vw, 680px);
    display: grid;
    gap: var(--fb-gap);
    text-align: center;
    cursor: pointer;
}

.fight-b .fb-boss__head {
    justify-content: center;
    gap: 10px;
}

.fight-b .fb-boss__name {
    min-width: 0;
    font-family: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
    font-weight: 600;
    font-size: var(--fb-fs-name);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffcf6b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fight-b .fb-boss .fb-bar {
    height: calc(var(--fb-bar-h) * 1.35);
}

/* ---------- ticker (top left) ---------- */
.fight-b .fb-tick {
    position: relative;
    flex: none;
    width: var(--fb-tick-w);
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px 44px 5px 9px;
    font-size: clamp(10px, 1.45dvh, 13px);
    line-height: 1.4;
    text-align: left;
}

.fight-b .fb-tick .log-entry {
    padding: 0;
    background: none;
    text-align: left;
}

.fight-b .fb-tick .log-turn-marker {
    margin: 0.1rem 0;
    font-size: 0.8em;
}

.fight-b .fb-tick__toggle {
    position: absolute;
    top: 3px;
    right: 3px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.6);
    color: #cfd6e4;
    font: 700 10px / 1 'Inter', system-ui, sans-serif;
    letter-spacing: 0.06em;
    padding: 3px 7px;
    cursor: pointer;
}

.fight-b .fb-tick__toggle:focus-visible {
    outline: 2px solid var(--fb-gold);
    outline-offset: 2px;
}

/* the whole log, opened from the ticker; reuses the old log box look */
.fight-b .fb-tick__full.asc-turn-combat-log {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: max(100%, 280px);
    max-height: min(50dvh, 320px);
    box-sizing: border-box;
    -webkit-mask-image: none;
    mask-image: none;
}

/* ---------- bottom bar: pupil card | abilities + Logic | backpack ---------- */
.fight-b .asc-command-interface {
    padding: clamp(5px, 1.1dvh, 12px) clamp(8px, 1.2vw, 18px);
    padding-bottom: calc(clamp(5px, 1.1dvh, 12px) + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.68);
}

.fight-b .fb-cmd {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(6px, 1.2vw, 18px);
    font-family: 'Inter', system-ui, sans-serif;
    color: #fff;
    line-height: 1.2;
}

.fight-b .fb-card--me {
    z-index: var(--fb-hud-z);
    width: clamp(190px, 24vw, 340px);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(6px, 1dvh, 10px);
    align-items: center;
    background: rgba(8, 12, 22, 0.85);
    border-color: rgba(255, 216, 138, 0.35);
}

.fight-b .fb-card--me .fb-bar {
    height: calc(var(--fb-bar-h) * 1.2);
}

.fight-b .fb-me-face {
    display: block;
    width: var(--fb-me-face);
    height: var(--fb-me-face);
    max-width: none;
    border-radius: 8px;
    background: #22314f;
    border: 1px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    image-rendering: pixelated;
}

.fight-b .fb-passive {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 99px;
    padding: 1px 7px 1px 2px;
    font-size: var(--fb-fs-val);
    font-weight: 700;
}

.fight-b .fb-passive img {
    width: calc(var(--fb-icon) * 0.9);
    height: calc(var(--fb-icon) * 0.9);
}

/* ---------- hover tips on status badges and the passive (same look as the ability tips) ---------- */
.fight-b .fb-tip-host {
    position: relative;
    cursor: help;
}

.fight-b .fb-tip-host:focus-visible {
    outline: 2px solid var(--fb-gold);
    outline-offset: 2px;
    border-radius: 6px;
}

.fight-b .fb-tip {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 100;
    flex-direction: column;
    gap: 3px;
    width: max-content;
    min-width: 170px;
    max-width: 240px;
    padding: 9px 12px;
    background: rgba(15, 16, 28, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    font: 400 12px / 1.35 'Inter', system-ui, sans-serif;
    color: rgba(255, 255, 255, 0.75);
    text-align: left;
    white-space: normal;
    pointer-events: none;
}

.fight-b .fb-tip-host:hover > .fb-tip,
.fight-b .fb-tip-host:focus > .fb-tip {
    display: flex;
}

/* the enemy cards sit at the top right: their tips open below and line up with the right edge */
.fight-b .fb-hud-top .fb-tip {
    top: calc(100% + 10px);
    bottom: auto;
    left: auto;
    right: 0;
}

.fight-b .fb-tip__name {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffd700;
}

.fight-b .fb-tip__tag {
    font-size: 11px;
    color: #8ec8f0;
}

.fight-b .fb-tip__value {
    font-size: 12px;
    font-weight: 700;
    color: #9be59b;
}

/* backpack: the icon grid scrolls inside the tray (two rows of tiles sized to the bar), so the tray
   itself never clips and the item tip can sit above it */
.fight-b .fb-cmd .asc-turn-item-tray-area {
    width: clamp(110px, 15vw, 220px);
    overflow: visible;
    box-sizing: border-box;
    padding: 5px 8px;
}

.fight-b .fb-cmd .item-tray__grid {
    --item-tile: clamp(28px, 4.6dvh, 40px);
}

/* ---------- abilities + Logic bar (option 2, ability preview) ---------- */
.fight-b .fb-cmd-mid {
    position: relative;
    display: grid;
    justify-items: center;
    gap: clamp(3px, 0.8dvh, 8px);
    min-width: 0;
}

.fight-b .fb-cmd .ability-bar {
    gap: clamp(5px, 1dvh, 12px);
    padding: clamp(4px, 1.2dvh, 10px) 0 0;
}

.fight-b .fb-cmd .ability-bar__slot {
    width: var(--fb-ab);
    height: var(--fb-ab);
    min-width: 40px;
    min-height: 40px;
    overflow: visible;
}

.fight-b .fb-cmd .ability-bar__icon {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.fight-b .fb-cmd .ability-bar__ghost {
    position: absolute;
    right: -12%;
    top: -14%;
    width: 48%;
    height: 48%;
    max-width: none;
    border-radius: 6px;
    border: 2px solid var(--fb-gold);
    background: #111;
    opacity: 0.6;
    filter: saturate(0.35);
    pointer-events: none;
    box-sizing: border-box;
}

.fight-b .fb-cmd .ability-bar__ghost--lit {
    opacity: 1;
    filter: none;
    box-shadow: 0 0 10px rgba(255, 216, 138, 0.95);
}

.fight-b .fb-cmd .ability-bar__new {
    position: absolute;
    left: 50%;
    bottom: -7px;
    transform: translateX(-50%);
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--fb-gold);
    color: var(--fb-gold-ink);
    font: 700 clamp(8px, 1.2dvh, 10px) / 1 'Inter', system-ui, sans-serif;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.fight-b .fb-cmd-mid--fresh .ability-bar__slot {
    box-shadow: 0 0 0 2px var(--fb-gold), 0 0 14px rgba(255, 216, 138, 0.85);
}

.fight-b .fb-powerup-banner {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--fb-hud-z);
    white-space: nowrap;
    font: 600 clamp(12px, 2.4dvh, 22px) / 1 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
    color: var(--fb-gold-ink);
    background: var(--fb-gold-fill);
    padding: 0.4em 1em;
    border-radius: 99px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.fight-b .fb-logic {
    display: flex;
    align-items: center;
    gap: clamp(5px, 1vw, 10px);
    font-size: clamp(9px, 1.45dvh, 13px);
    font-weight: 700;
    color: #cfd6e4;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fight-b .fb-logic__label {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 99px;
    padding: 2px 8px;
    letter-spacing: 0.06em;
}

.fight-b .fb-logic__label--gold {
    color: var(--fb-gold-ink);
    background: var(--fb-gold-fill);
    border-color: var(--fb-gold);
}

.fight-b .fb-logic__bar {
    position: relative;
    display: block;
    width: clamp(110px, 17vw, 260px);
    height: clamp(6px, 1.1dvh, 11px);
    background: rgba(255, 255, 255, 0.14);
    border-radius: 99px;
}

.fight-b .fb-logic__bar--goal {
    margin-right: clamp(10px, 2dvh, 18px);
}

.fight-b .fb-logic__fill {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #a5b4fc, #e0e7ff);
    transition: width 0.3s ease;
}

.fight-b .fb-logic--maxed .fb-logic__fill {
    background: linear-gradient(90deg, #f2b544, #ffe7a3);
    box-shadow: 0 0 10px rgba(255, 216, 138, 0.7);
}

.fight-b .fb-logic__goal {
    position: absolute;
    right: calc(clamp(18px, 3.4dvh, 30px) / -2);
    top: 50%;
    margin-top: calc(clamp(18px, 3.4dvh, 30px) / -2);
    width: clamp(18px, 3.4dvh, 30px);
    height: clamp(18px, 3.4dvh, 30px);
    box-sizing: border-box;
    border-radius: 50%;
    background: #1e2a48;
    border: 2px solid var(--fb-gold);
    display: grid;
    place-items: center;
}

.fight-b .fb-logic__goal svg {
    width: 62%;
    height: 62%;
    fill: var(--fb-gold);
}

.fight-b .fb-logic--near .fb-logic__fill {
    background: linear-gradient(90deg, #c4b5fd, #fff3c4);
    box-shadow: 0 0 10px rgba(255, 216, 138, 0.85);
}

.fight-b .fb-logic--near .fb-logic__goal {
    background: var(--fb-gold);
    box-shadow: 0 0 0 3px rgba(255, 216, 138, 0.3), 0 0 16px rgba(255, 216, 138, 0.95);
}

.fight-b .fb-logic--near .fb-logic__goal svg {
    fill: var(--fb-gold-ink);
}

.fight-b .fb-logic__num--more {
    color: var(--fb-gold);
}

/* ---------- question open: the panel sits in the fight area, under the top HUD ---------- */
.fight-b .question-overlay {
    position: absolute;
    padding: calc(var(--fb-hud-h) + var(--fb-edge-y) * 2) var(--fb-edge-x) var(--fb-edge-y);
}

.fight-b .question-overlay__backdrop {
    position: absolute;
}

.fight-b .question-overlay__panel {
    width: min(600px, 50vw);
    max-height: 100%;
}

.fight-b .question-overlay__panel--card {
    width: min(760px, 62vw);
}

/* a wide lesson card would run under the ticker: the ticker steps aside while it is up */
.fight-b:has(.question-overlay__panel--card) .fb-tick {
    visibility: hidden;
}

/* the pupil's controls rest while a question is open; their own card stays bright */
.fight-b:has(.question-overlay--visible) .fb-cmd-mid > :not(.fb-powerup-banner),
.fight-b:has(.question-overlay--visible) .fb-cmd .asc-turn-item-tray-area {
    opacity: 0.4;
}

.fight-b:has(.question-overlay--visible) .fb-card,
.fight-b:has(.question-overlay--visible) .fb-boss {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

/* ---------- motion (none when the device asks for reduced motion: the static ring stays) ---------- */
@media (prefers-reduced-motion: no-preference) {
    .fight-b .fb-card.fb-hit,
    .fight-b .fb-boss.fb-hit {
        animation: fb-card-hit 1.1s ease-out 1;
    }

    .fight-b .fb-bar__trail {
        animation: fb-trail 1.1s ease-in 1 forwards;
    }

    .fight-b .fb-logic--near .fb-logic__goal,
    .fight-b .fb-cmd .ability-bar__ghost--lit {
        animation: fb-grow 1.2s ease-in-out infinite;
    }

    .fight-b .fb-powerup-banner {
        animation: fb-banner-pop 0.45s ease-out 1;
    }
}

@keyframes fb-card-hit {
    0% { background: var(--fb-panel); }
    18% { background: rgba(140, 24, 24, 0.9); }
    60%, 100% { background: var(--fb-panel); }
}

@keyframes fb-trail {
    0%, 35% { opacity: 1; }
    100% { opacity: 0.25; }
}

@keyframes fb-grow {
    50% { scale: 1.15; }
}

@keyframes fb-banner-pop {
    0% { transform: translateX(-50%) scale(0.6); opacity: 0; }
    70% { transform: translateX(-50%) scale(1.08); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); }
}

/* ---------- narrow 4:3 tablets ---------- */
@media (max-width: 1100px) and (min-height: 481px) {
    .fight-b {
        --fb-tick-w: clamp(140px, 17vw, 220px);
    }
}

/* ---------- short screens: sideways phones ---------- */
@media (max-height: 480px) {
    .fight-b {
        --fb-tick-w: clamp(130px, 18vw, 200px);
    }

    /* one line: the latest thing that happened (never a bare turn marker) */
    .fight-b .fb-tick__lines > :not(.fb-tick__latest) {
        display: none;
    }

    /* the characters are drawn for a tall fight area; on a sideways phone they would reach the top HUD */
    .fight-b .asc-character-sprite-container,
    .fight-b .asc-tutorial-enemy-sprite-container {
        transform: scale(0.62);
        transform-origin: center bottom;
    }

    /* the question panel is half the width of a short screen: smaller type and buttons */
    .fight-b .question-overlay .asc-question-display--overlay {
        font-size: clamp(15px, 4.6dvh, 22px);
    }

    .fight-b .question-overlay__options {
        gap: 6px;
    }

    .fight-b .question-overlay__option,
    .fight-b .question-overlay__input {
        min-height: 38px;
        padding: 6px 10px;
        font-size: 1rem;
    }

    .fight-b .question-overlay__submit {
        min-height: 38px;
        padding: 6px 16px;
        font-size: 1rem;
    }

    .fight-b .fb-card--me {
        width: clamp(180px, 24vw, 240px);
    }

    .fight-b .fb-logic__label:not(.fb-logic__label--gold) {
        display: none;
    }

    .fight-b .fb-cmd .asc-turn-item-tray-area {
        width: clamp(96px, 14vw, 160px);
    }

    /* the question panel takes the left of the fight area; the enemy cards keep the right */
    .fight-b .question-overlay {
        justify-content: flex-start;
        align-items: flex-start;
        padding: var(--fb-edge-y) var(--fb-edge-x);
    }

    .fight-b .question-overlay__panel,
    .fight-b .question-overlay__panel--card {
        width: 52vw;
        padding: 10px 12px;
        gap: 8px;
    }

    .fight-b:has(.question-overlay--visible) .fb-tick {
        visibility: hidden;
    }

    .fight-b:has(.question-overlay--visible) .fb-foes {
        max-width: calc(48vw - var(--fb-edge-x) * 3);
    }

    .fight-b:has(.question-overlay--visible) .fb-boss {
        left: auto;
        right: 0;
        transform: none;
        width: calc(46vw - var(--fb-edge-x) * 3);
    }
}
