/* v2.75 final game polish: aligned HUD controls, ruler portrait crest, synchronized damage feedback. */

.compact-top .hud-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compact-top .hud-controls > .audio-btn,
.compact-top .hud-controls > .hud-brief-menu,
.compact-top .hud-brief-menu > summary {
  margin: 0;
}

.compact-top .hud-controls > .audio-btn,
.compact-top .hud-brief-menu > summary {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-height: 30px;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}

.compact-top .hud-brief-menu {
  display: flex;
  align-items: center;
  height: 30px;
}

.hud-ruler-badge {
  display: grid;
  flex: 0 0 auto;
  justify-items: center;
  gap: 2px;
  line-height: 1;
}

.hud-ruler-badge > small {
  color: #d7c5a0;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.hud-ruler-portrait {
  overflow: hidden;
}

.hud-crest.hud-ruler-portrait img,
.compact-top .hud-crest.hud-ruler-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 16%;
  border-radius: inherit;
  filter: none;
}

/* Damage number, troop bar, and troop count all begin on the collision beat. */
.battle-screen-v271 .battle-hp-apply-v271 {
  animation-delay: 1.76s;
}

.battle-screen-v271.battle-speed-2 .battle-hp-apply-v271 {
  animation-delay: .88s;
}

/*
 * v2.76 mobile HUD alignment hotfix.
 * gameplay-v234.css detached the turn-end control from the header with
 * position: fixed on mobile. Keep every top control in the same flex row.
 */
@media (max-width: 760px) {
  .compact-top .hud-main {
    padding-right: 0;
  }

  .compact-top .hud-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .compact-top .hud-controls {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
  }

  .compact-top .hud-brief-menu {
    order: 1;
  }

  .compact-top .ai-speed-btn {
    order: 2;
  }

  .compact-top .hud-controls > [data-action="open-settings"] {
    order: 3;
  }

  .compact-top .hud-controls > .hud-end-turn {
    position: static;
    inset: auto;
    top: auto;
    right: auto;
    z-index: auto;
    order: 4;
    display: inline-grid;
    align-content: center;
    align-self: center;
    height: 30px;
    min-height: 30px;
    min-width: 76px;
    padding: 2px 6px;
    margin: 0;
    gap: 1px;
    line-height: 1;
    transform: none;
  }

  .compact-top .hud-controls > .hud-end-turn:hover:not(:disabled) {
    transform: none;
  }

  .compact-top .hud-end-turn > span,
  .compact-top .hud-end-turn > small {
    display: block;
    margin: 0;
    line-height: 1;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .compact-top .hud-main {
    gap: 5px;
  }

  .compact-top .hud-controls {
    align-items: center;
    gap: 3px;
  }

  .compact-top .hud-controls > .audio-btn,
  .compact-top .hud-brief-menu > summary,
  .compact-top .hud-brief-menu {
    height: 28px;
    min-height: 28px;
  }

  .compact-top .hud-controls > .hud-end-turn {
    height: 28px;
    min-height: 28px;
    min-width: 68px;
    padding: 1px 5px;
  }

  .compact-top .hud-end-turn > small {
    font-size: 6px;
  }

  .compact-top .ai-speed-btn {
    min-width: 44px;
  }

  .hud-ruler-badge > small {
    font-size: 7px;
  }
}
