/* Heroes, champions and their places in the interface. */
.hero-strip {
  position: absolute;
  left: 26px;
  top: 150px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 4;
}
.hero-strip.hidden {
  display: none;
}
.hero-slot {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 50%;
  --hp: 0;
}
.hero-portrait {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #4b4330, #2a271d 70%), var(--wood);
  box-shadow:
    inset 0 0 0 1px #00000066,
    0 2px 8px #2a1d0d55;
}
.hero-portrait img {
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 58px;
  height: 58px;
  transform: translateX(-50%);
  object-fit: contain;
}
/* A golden ring that drains with the hero's health. */
.hero-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#f2cf6e calc(var(--hp) * 360deg), #4b3f2a calc(var(--hp) * 360deg));
  -webkit-mask: radial-gradient(circle, transparent 23px, #000 24px);
  mask: radial-gradient(circle, transparent 23px, #000 24px);
  box-shadow: 0 0 0 1px #2a2116;
}
.hero-slot[data-state='available'] .hero-ring {
  background: #6b5a39;
}
.hero-slot[data-state='available'].affordable .hero-ring {
  background: conic-gradient(from 0deg, #c4a463, #f2cf6e, #c4a463);
  animation: hero-call 2.4s ease-in-out infinite;
}
.hero-slot[data-state='available'] .hero-portrait img,
.hero-slot[data-state='returning'] .hero-portrait img {
  filter: grayscale(0.75) brightness(0.72);
}
.hero-slot[data-state='available'].affordable .hero-portrait img {
  filter: grayscale(0.2) brightness(0.92);
}
.hero-slot[data-state='returning'] .hero-ring {
  background: #3e3626;
}
.hero-slot.selected .hero-ring {
  box-shadow:
    0 0 0 2px #9de0ba,
    0 0 12px #9de0ba99;
}
.hero-crest {
  position: absolute;
  right: -3px;
  top: -2px;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2a2116;
  color: #f2cf6e;
  box-shadow: 0 0 0 1px #c4a463;
}
.hero-state {
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  min-width: 30px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #241f16ee;
  color: #f2dc9a;
  font: 600 10px/1.3 var(--sans);
  letter-spacing: 0.3px;
  box-shadow: 0 0 0 1px #8a7341;
}
.hero-state:empty {
  display: none;
}
.hero-slot[data-state='available'] .hero-state::before {
  content: '◉ ';
  color: #e2bd5c;
}
.hero-name {
  position: absolute;
  left: 62px;
  top: 50%;
  transform: translateY(-50%);
  font: 13px var(--serif);
  color: #4e442e;
  text-shadow: 0 1px #f0dfb6aa;
  white-space: nowrap;
  pointer-events: none;
}
@keyframes hero-call {
  50% {
    filter: brightness(1.25);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-slot[data-state='available'].affordable .hero-ring {
    animation: none;
  }
}

/* Champion health along the top edge of the battlefield. */
.boss-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  width: min(360px, calc(100% - 640px));
  min-width: 240px;
  z-index: 5;
  pointer-events: none;
}
.boss-bar.hidden {
  display: none;
}
.boss-row {
  padding: 6px 12px 8px;
  background: linear-gradient(180deg, #3a1a14f2, #2a140ff2);
  box-shadow:
    inset 0 0 0 1px #a2483a,
    0 4px 14px #2a0f0a55;
  border-radius: 2px;
}
.boss-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 13px var(--serif);
  color: #f3c7b5;
  letter-spacing: 0.2px;
}
.boss-name svg {
  color: #e07a5f;
}
.boss-health {
  display: block;
  height: 5px;
  margin-top: 5px;
  background: #1a0b08;
  box-shadow: inset 0 0 0 1px #5a2a20;
}
.boss-health i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #a8321f, #e0573f);
  transition: width 0.25s;
}

/* Hero abilities in the selection panel. */
.hero-skills {
  margin: 8px 0 2px;
  padding: 8px 10px;
  border-left: 2px solid #c4a463;
  background: #f2cf6e12;
}
.hero-skills p {
  margin: 0 0 4px;
  font-size: 11px;
  line-height: 1.45;
}
.hero-skills b {
  color: #f2dc9a;
}

/* Field guide cards. */
.hero-guide p {
  margin: 4px 0 10px;
}
.hero-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin: 8px 0 18px;
}
.hero-card {
  padding: 10px 12px 8px;
  background: #fff8e436;
  box-shadow: inset 0 0 0 1px #a2834659;
  border-radius: 2px;
}
.hero-card.boss {
  background: #7a1d140d;
  box-shadow: inset 0 0 0 1px #a2483a55;
}
.hero-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-card-head img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #4b4330, #2a271d 72%);
  box-shadow: 0 0 0 2px #c4a463;
}
.hero-card.boss .hero-card-head img {
  box-shadow: 0 0 0 2px #a2483a;
}
.hero-card-head h4 {
  margin: 0;
  font: 15px var(--serif);
  color: #4e3d22;
}
.hero-card-head span {
  font-size: 10px;
  letter-spacing: 0.6px;
  color: #7d6a45;
}
.hero-card-head i {
  margin-left: auto;
  color: #a4884f;
}
.hero-card p {
  margin: 6px 0;
  font-size: 11px;
  line-height: 1.45;
  color: #5d4f33;
}
.hero-card b {
  color: #3f321c;
}
.hero-lore {
  font-style: italic;
}
.hero-stats {
  font-size: 10px !important;
  letter-spacing: 0.4px;
  color: #8a7650 !important;
}

/* Phones: compact portraits under the wave banner, names hidden. */
@media (max-width: 900px), (pointer: coarse), (max-height: 600px) and (orientation: landscape) {
  .hero-strip {
    left: 8px;
    top: 64px;
    gap: 7px;
  }
  .hero-slot {
    width: 46px;
    height: 46px;
  }
  .hero-ring {
    -webkit-mask: radial-gradient(circle, transparent 19px, #000 20px);
    mask: radial-gradient(circle, transparent 19px, #000 20px);
  }
  .hero-portrait img {
    width: 50px;
    height: 50px;
  }
  .hero-name {
    display: none;
  }
  .boss-bar {
    top: 62px;
    left: auto;
    right: 8px;
    transform: none;
    width: min(260px, calc(100% - 80px));
    min-width: 0;
  }
  .boss-row {
    padding: 4px 9px 6px;
  }
  .boss-name {
    font-size: 11px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .hero-strip {
    flex-direction: row;
    top: auto;
    bottom: 64px;
  }
}

/* Game setup: campaign or skirmish, battlefield, raiders or warlord. */
dialog.modal.setup {
  max-width: none;
  width: min(860px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}
.setup-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 14px;
}
.setup-modes button,
.setup-choices button {
  padding: 10px 12px;
  text-align: left;
  font: 15px var(--serif);
  color: #4e3d22;
  background: #fff8e430;
  box-shadow: inset 0 0 0 1px #a2834659;
  border-radius: 2px;
}
.setup-modes button small,
.setup-choices button small {
  display: block;
  margin-top: 2px;
  font: 11px var(--sans);
  color: #7d6a45;
}
.setup-modes [aria-selected='true'],
.setup-choices [aria-checked='true'],
.setup-maps [aria-checked='true'],
.setup-opponents [aria-checked='true'] {
  background: #f2cf6e33;
  box-shadow:
    inset 0 0 0 2px #b08a3e,
    0 2px 8px #6b4b1a22;
}
.setup-label {
  display: block;
  margin: 10px 0 6px;
  font-size: 9px;
  letter-spacing: 1.8px;
  color: #817047;
}
.setup-maps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.setup-maps button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 8px;
  text-align: left;
  background: #fff8e430;
  box-shadow: inset 0 0 0 1px #a2834659;
  border-radius: 2px;
  color: #4e3d22;
}
.setup-maps img {
  width: 100%;
  height: auto;
  aspect-ratio: 220 / 116;
  border-radius: 2px;
  background: #2a271d;
}
.setup-maps b {
  font: 15px var(--serif);
}
.setup-maps small {
  font-size: 11px;
  line-height: 1.35;
  color: #6d5c3b;
}
.setup-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.setup-opponents {
  display: grid;
  gap: 8px;
}
.setup-opponents button {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  text-align: left;
  color: #4e3d22;
  background: #fff8e430;
  box-shadow: inset 0 0 0 1px #a2834659;
  border-radius: 2px;
}
.setup-opponents img {
  width: 56px;
  height: 56px;
  flex: none;
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #4b4330, #2a271d 72%);
  box-shadow: 0 0 0 2px #a2483a;
}
.setup-opponents b {
  display: block;
  font: 15px var(--serif);
}
.setup-opponents em {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  font-style: normal;
  color: #9a4a35;
  text-transform: uppercase;
}
.setup-opponents small {
  display: block;
  margin: 3px 0 4px;
  font-size: 11px;
  line-height: 1.4;
  color: #6d5c3b;
}
.setup-opponents .traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.setup-opponents .traits i {
  padding: 1px 7px;
  font-size: 10px;
  border-radius: 8px;
  background: #7a1d1412;
  color: #7a3a26;
  box-shadow: inset 0 0 0 1px #a2483a44;
}
#setupStart {
  margin-top: 12px;
  width: 100%;
}
.setup .hidden {
  display: none;
}
@media (max-width: 640px) {
  .setup-maps,
  .setup-choices {
    grid-template-columns: 1fr;
  }
  .setup-maps button {
    flex-direction: row;
    align-items: center;
  }
  .setup-maps img {
    width: 110px;
    flex: none;
  }
}

/* Skirmish setup: one card per rival lord with its level. */
.setup-lords {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.lord-card {
  padding: 10px 11px 9px;
  color: #4e3d22;
  background: #fff8e425;
  box-shadow: inset 0 0 0 1px #a2834659;
  border-radius: 2px;
  opacity: 0.78;
}
.lord-card.on {
  opacity: 1;
  background: #f2cf6e2b;
  box-shadow:
    inset 0 0 0 2px #b08a3e,
    0 2px 8px #6b4b1a22;
}
.lord-card header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.lord-card b {
  display: block;
  font: 15px var(--serif);
}
.lord-card small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: #6d5c3b;
}
.lord-crest {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fbe9c2;
  background: radial-gradient(circle at 40% 30%, color-mix(in srgb, var(--lord) 70%, #fff), var(--lord) 70%);
  box-shadow:
    0 0 0 2px #f6e6c0,
    0 0 0 3px #a2834688;
}
.lord-levels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 9px;
}
.lord-levels button {
  padding: 6px 2px;
  font: 11px var(--sans);
  color: #6d5c3b;
  background: #fff8e420;
  box-shadow: inset 0 0 0 1px #a2834659;
  border-radius: 2px;
}
.lord-levels [aria-checked='true'] {
  color: #7a2a1a;
  background: #a2483a1c;
  box-shadow: inset 0 0 0 2px #a2483a;
}
.lord-levels [data-level='off'][aria-checked='true'] {
  color: #6d5c3b;
  background: #7d6a4514;
  box-shadow: inset 0 0 0 2px #a2834699;
}
.setup-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: #6d5c3b;
}
.setup-opponents {
  grid-template-columns: 1fr 1fr;
}
.leader-none {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  color: #e6d3a6;
  background: radial-gradient(circle at 50% 35%, #4b4330, #2a271d 72%);
  box-shadow: 0 0 0 2px #8a7a55;
}
@media (max-width: 640px) {
  .setup-lords,
  .setup-opponents {
    grid-template-columns: 1fr;
  }
}

/* Skirmish: the siege panel lists the rival lords. */
.wave-panel.skirmish #waveDescription {
  display: grid;
  gap: 4px;
  margin: 7px 0 11px;
}
.rival-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #6d5c3b;
}
.rival-row i {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lord);
  box-shadow: 0 0 0 1px #fff6;
}
.rival-row b {
  font: 13px var(--serif);
  font-weight: normal;
  color: #4e442e;
}
.rival-row em {
  font-style: normal;
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9a4a35;
}
.rival-row span {
  margin-left: auto;
}
.rival-row.fallen {
  opacity: 0.55;
}
.rival-row.fallen b {
  text-decoration: line-through;
}

/* A labelled switch in the setup and settings dialogs. */
.setup-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 9px 11px;
  border-radius: 2px;
  background: #fff8e425;
  box-shadow: inset 0 0 0 1px #a2834659;
  cursor: pointer;
  text-align: left;
}
.setup-toggle input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #8a6a2e;
  flex: none;
}
.setup-toggle b {
  display: block;
  font: 14px var(--serif);
  color: #4e3d22;
}
.setup-toggle small {
  display: block;
  font-size: 11px;
  color: #6d5c3b;
  line-height: 1.35;
}
#setupLength {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 640px) {
  #setupLength {
    grid-template-columns: 1fr 1fr;
  }
}

/* Setup on phones: compact battlefield cards, the start button always in reach. */
@media (max-width: 640px) {
  .setup-maps button {
    display: grid;
    grid-template-columns: 96px 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 10px;
    align-items: start;
  }
  .setup-maps img {
    grid-row: 1 / 3;
    width: 96px;
  }
  .setup-maps b {
    font-size: 15px;
  }
  #setupStart {
    position: sticky;
    bottom: -1px;
    z-index: 2;
    box-shadow: 0 -10px 18px #e3d2a9;
  }
}
