/* «Костёр до рассвета»: a dusky forest clearing, with the meadow's felt controls. */
@font-face {
  font-family: "Alegreya";
  src: url(fonts/alegreya-cyrillic.woff2) format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Alegreya";
  src: url(fonts/alegreya-latin.woff2) format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

#hordeHud {
  --pine: #1c2e24ee;
  --moss: #2c4535;
  --edge: #4f6e55;
  --ink: #f2ead2;
  --gold: #ffd27a;
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  font: 800 16px Nunito, system-ui, sans-serif;
  color: var(--ink);
}
#hordeHud.hidden { display: none; }
#hordeField { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: auto; touch-action: none; }
.hh-panel {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px 26px 12px;
  background: var(--pine);
  border: 2px solid var(--edge);
  border-radius: 16px;
  box-shadow: 0 8px 24px #0009, inset 0 0 0 1px #0006;
}
#hhSlots { display: flex; gap: 10px; }
.hh-slot {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  font: inherit;
  color: inherit;
  background: var(--moss);
  border: 2px solid var(--edge);
  border-radius: 10px;
  box-shadow: inset 0 2px 8px #0006;
  cursor: pointer;
  pointer-events: auto;
}
.hh-slot:hover { border-color: #8db08f; }
.hh-slot[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 14px 2px #ffb84a99, inset 0 0 10px #ffb84a44; }
.hh-slot.poor i { filter: grayscale(0.8) brightness(0.65); }
.hh-slot i { position: absolute; inset: 2px; background: url(img/horde/buildings.webp) 0 0 / 400% 200% no-repeat; }
.hh-slot kbd { position: absolute; top: 2px; left: 4px; font: inherit; font-size: 12px; color: var(--gold); text-shadow: 0 1px 2px #000; }
.hh-slot span { position: absolute; right: 4px; bottom: 1px; font-size: 13px; color: var(--gold); text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.hh-sep { width: 2px; align-self: stretch; margin: 4px 0; background: var(--edge); }
.hh-wave { display: grid; min-width: 150px; }
.hh-wave > b, #hhExit, #hhBanner, #hhEnd b { font-family: Alegreya, Georgia, serif; }
.hh-wave > b { font-size: 34px; line-height: 1.05; }
#hhFire { font-style: normal; margin-right: 8px; }
#hhFire.low, .hh-wave em#hhLeft.low { color: #ff7a5a; opacity: 1; }
#hhFire { display: inline-block; transition: transform 0.12s, color 0.12s; }
#hhFire.hot { transform: scale(1.18); color: #ff7a5a; opacity: 1; }
#hhFireBar { height: 9px; margin-top: 5px; }
#hhSkip { justify-self: start; min-height: 32px; margin-top: 6px; padding: 0 14px; font: inherit; font-size: 14px; color: #2a1c08; background: var(--gold); border: 0; border-radius: 999px; cursor: pointer; pointer-events: auto; }
#hhSkip[hidden], #hhGive[hidden] { display: none; }
#hhGive { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 260px; }
#hhGive button { min-height: 28px; padding: 0 10px; font: inherit; font-size: 13px; color: inherit; background: var(--moss); border: 2px solid var(--edge); border-radius: 999px; cursor: pointer; pointer-events: auto; }
#hhGive button:hover, #hhGive button:focus-visible { border-color: var(--gold); outline: none; }
#hhGive button:disabled { opacity: 0.5; cursor: default; }
.hh-wave em#hhBank { color: var(--gold); }
#hhSkip:disabled { color: inherit; background: transparent; box-shadow: inset 0 0 0 2px var(--edge); cursor: default; }
#hhSkip:focus-visible { outline: 3px solid #fff; }
#hhFireBar > i { background-color: #f08a3a; }
#hhFireBar.low > i { background-color: #e0503a; }
#hhFireBar.hot > i { background-color: var(--gold); }
.hh-slot em { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 3px; font-style: normal; font-size: 12px; white-space: nowrap; opacity: 0.85; }
.hh-slot:disabled { cursor: default; }
.hh-slot:disabled i { filter: grayscale(0.6) brightness(0.55); }
#hhBanner { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); margin: 0; white-space: nowrap; font-size: 44px; color: var(--gold); text-shadow: 0 2px 6px #000, 0 0 18px #000; opacity: 0; transition: opacity 0.4s; }
#hhBanner.on { opacity: 1; }
#hhEnd { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-height: calc(100% - 24px); overflow-y: auto; box-sizing: border-box; display: grid; justify-items: center; gap: 10px; min-width: min(360px, 86vw); padding: 22px 28px; text-align: center; background: var(--pine); border: 2px solid var(--gold); border-radius: 18px; box-shadow: 0 12px 40px #000c; pointer-events: auto; }
#hhEnd[hidden], #hhSlots[hidden] { display: none; }
#hhNecro { display: flex; gap: 10px; }
#hhNecro[hidden], #hordeHud.necro :is(#hhSlots, #hhFix, .hh-wave img, #hhGold, #hhBank, #hhGive, #hhSkip) { display: none; }
#hhNecro .hh-slot i { display: grid; place-items: center; background: none; color: #c9b8ff; }
#hhNecro .hh-slot svg { width: 28px; height: 28px; }
#hhEnd b { font-size: 36px; color: var(--gold); }
#hhEnd span { font-size: 18px; line-height: 1.4; }
#hhStats { border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
#hhStats th, #hhStats td { padding: 3px 10px; text-align: right; }
#hhStats th:first-child, #hhStats td:first-child { text-align: left; }
#hhStats thead th { font-weight: 400; opacity: 0.75; }
#hhStats tbody + tbody tr:first-child td { border-top: 1px solid #fff3; padding-top: 8px; }
#hhStats .me td { color: var(--gold); }
#hhEndGo { min-height: 48px; padding: 0 26px; font: inherit; font-size: 18px; color: #2a1c08; background: var(--gold); border: 0; border-radius: 999px; cursor: pointer; }
#hhEndGo:focus-visible { outline: 3px solid #fff; }
.hh-wave span { display: flex; align-items: center; gap: 6px; font-size: 15px; white-space: nowrap; }
.hh-wave img { width: 18px; height: 18px; border-radius: 50%; }
.hh-wave b#hhGold { color: var(--gold); }
.hh-wave em { font-style: normal; opacity: 0.8; margin-left: 6px; }
#hhHint { position: absolute; bottom: 140px; left: 50%; transform: translateX(-50%); margin: 0; white-space: nowrap; font-size: 15px; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
#hhExit { position: absolute; top: 14px; left: 14px; padding: 8px 18px; font: inherit; color: inherit; background: var(--pine); border: 2px solid var(--edge); border-radius: 999px; cursor: pointer; pointer-events: auto; }
#hhExit:hover, .hh-slot:focus-visible, #hhExit:focus-visible { border-color: var(--gold); outline: none; }
@media (max-width: 760px) {
  /* two rows of 48 px buttons: a finger needs 44 px at least */
  .hh-panel { gap: 8px; padding: 6px 10px 6px 6px; bottom: 8px; }
  #hhSlots { display: grid; grid-template-columns: repeat(4, 48px); gap: 4px; }
  .hh-slot { width: 48px; height: 48px; }
  .hh-slot kbd, .hh-slot em { display: none; }
  .hh-slot span { font-size: 15px; }
  .hh-wave { min-width: 0; }
  .hh-wave > b { font-size: 22px; }
  .hh-wave span { flex-wrap: wrap; white-space: normal; }
  #hhHint { bottom: 136px; max-width: 92vw; white-space: normal; text-align: center; font-size: 14px; }
  #hhBanner { font-size: 28px; white-space: normal; width: 92vw; text-align: center; }
}
#hhFix i { background: url(img/horde/cursor/repair.png) center / 70% no-repeat; }
#hhFix[hidden], #hhMenu[hidden], #hhMenu [hidden] { display: none; }
#hhMenu { position: absolute; transform: translateX(-50%); display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 12px; align-items: center; width: 370px; max-width: calc(100vw - 16px); box-sizing: border-box; overflow: auto; padding: 16px; color: var(--ink-soft); pointer-events: auto; }
#hhMenuPic { grid-row: span 2; width: 64px; height: 64px; background: url(img/horde/buildings.webp) 0 0 / 400% 200% no-repeat; }
#hhMenuName { align-self: end; padding-right: 42px; font-size: 20px; line-height: 1.15; }
#hhMenuLv { align-self: start; font-size: 14px; letter-spacing: 2px; color: var(--mark); }
#hhMenuX { position: absolute; top: 14px; right: 14px; }
#hhMenuStats { grid-column: 1 / -1; margin-top: 6px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
#hhMenuStats td { padding: 2px 6px 2px 0; }
#hhMenuStats td + td { text-align: right; }
#hhMenuStats .next { color: var(--ok); }
#hhUp { grid-column: 1 / -1; margin-top: 8px; cursor: url(img/horde/cursor/up.png) 12 1, pointer; }
#hhUp img { width: 22px; height: 22px; }
#hhMenu .pebble:not([aria-pressed="true"]) { color: var(--ink-soft); }
.hh-menu-row { grid-column: 1 / -1; display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.hh-menu-row button { gap: 4px; padding: 0 12px 0 6px; font-size: 14px; }
.hh-menu-row button[hidden] { display: none; }
.hh-menu-row img { width: 30px; height: 30px; }
#hhMend { cursor: url(img/horde/cursor/repair.png) 12 10, pointer; }
#hhSell { cursor: url(img/horde/cursor/sell.png) 20 20, pointer; }
#hhMenu button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#hhBranches { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
#hhBranches button { min-width: 0; display: grid; justify-items: center; align-content: start; gap: 4px; padding: 8px; text-align: center; line-height: 1.2; }
#hhBranches i { width: 56px; height: 56px; }
#hhBranches b { font-size: 15px; }
#hhBranches span { font-size: 14px; font-weight: 700; }
#hhBranches small { font-size: 13px; font-weight: 700; }
#hhBranches .hh-trade-value { white-space: nowrap; }
#hhAim { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
#hhAim > span { flex-basis: 100%; }
#hhAimModes { display: flex; flex: 1 1 190px; gap: 4px; }
#hhAimModes button { flex: 1; min-width: 44px; min-height: 52px; display: grid; justify-items: center; gap: 0; padding: 6px 2px; font-size: 13px; }
#hhAimModes i { width: 30px; height: 30px; }
#hhAimAll { flex: 0 0 auto; padding: 0 6px; font-size: 13px; }
#hordeField { cursor: url(img/horde/cursor/point.png) 6 1, auto; }
#hordeField[data-cur="up"] { cursor: url(img/horde/cursor/up.png) 12 1, pointer; }
#hordeField[data-cur="repair"] { cursor: url(img/horde/cursor/repair.png) 12 10, pointer; }
#hordeField[data-cur="build"] { cursor: url(img/horde/cursor/build.png) 3 2, crosshair; }
#hordeField[data-cur="no"] { cursor: url(img/horde/cursor/no.png) 20 20, not-allowed; }
#hordeField[data-cur="nofix"] { cursor: url(img/horde/cursor/nofix.png) 20 20, not-allowed; }
/* held press: the same cursor pushed in, so a click is felt before the game answers */
#hordeField[data-down] { cursor: url(img/horde/cursor/point-down.png) 6 1, auto; }
#hordeField[data-down][data-cur="up"] { cursor: url(img/horde/cursor/up-down.png) 12 1, pointer; }
#hordeField[data-down][data-cur="repair"] { cursor: url(img/horde/cursor/repair-down.png) 12 10, pointer; }
#hordeField[data-down][data-cur="build"] { cursor: url(img/horde/cursor/build-down.png) 3 2, crosshair; }
#hordeField[data-down][data-cur="no"] { cursor: url(img/horde/cursor/no-down.png) 20 20, not-allowed; }
#hordeField[data-down][data-cur="nofix"] { cursor: url(img/horde/cursor/nofix-down.png) 20 20, not-allowed; }
