/* Horda: ekran gry (plansza, pasek doświadczenia, okna awansu / pauzy / końca, gałka) i wybór bohatera. */

#screen-horde { position: relative; background: #16301a; touch-action: none; user-select: none; -webkit-user-select: none; }
#screen-horde.hidden { display: none; }
#hd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

/* Pasek u góry: doświadczenie na całą szerokość, pod nim pauza – czas – potwory. */
#hd-hud { position: absolute; inset: 0 0 auto 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#hd-hud button { pointer-events: auto; }
#hd-xp { position: relative; width: 100%; height: 16px; background: rgba(0, 0, 0, .55); border-bottom: 1px solid rgba(255, 255, 255, .15); }
#hd-xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #3a8cff, #6fe1ff); transition: width .15s linear; }
#hd-level { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px #000; letter-spacing: .5px; }
#hd-bar { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 10px; }
#hd-pause { justify-self: start; min-width: 42px; font-size: 16px; color: #fff; background: rgba(10, 4, 24, .65); border: 1px solid rgba(255, 255, 255, .3); }
#hd-time { font-size: 24px; font-weight: 900; color: #fff; text-shadow: 0 2px 4px #000; font-variant-numeric: tabular-nums; }
#hd-kills { justify-self: end; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; }

#hd-boss { width: min(440px, 80vw); text-align: center; }
#hd-boss.hidden { display: none; }
#hd-boss-name { font-weight: 900; color: #ffd1dc; text-shadow: 0 1px 3px #000; font-size: 14px; }
.hd-boss-track { height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .3); overflow: hidden; }
#hd-boss-fill { height: 100%; background: linear-gradient(90deg, #ff2d55, #ff8a5c); transition: width .2s linear; }

/* Zaklęcia i ulepszenia bohatera – lewy dolny róg. */
#hd-spells { position: fixed; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 50vw; pointer-events: none; }
#screen-horde.hidden #hd-spells { display: none; }
.hd-spell { position: relative; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 19px;
  background: rgba(20, 8, 40, .75); border: 1px solid var(--line); }
.hd-spell.passive { border-color: rgba(120, 220, 160, .45); }
.hd-spell-lv { position: absolute; right: -3px; bottom: -3px; min-width: 15px; height: 15px; border-radius: 8px; font-size: 10px; font-weight: 900;
  display: grid; place-items: center; background: var(--gold); color: #2a0a40; }

#hd-banner { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  font-size: clamp(20px, 4vw, 34px); font-weight: 900; color: #fff; text-shadow: 0 3px 8px #000, 0 0 18px rgba(255, 80, 80, .6);
  animation: hd-banner .35s ease-out; }
#hd-banner.hidden { display: none; }
@keyframes hd-banner { from { transform: translateX(-50%) scale(1.4); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

#hd-conn { position: absolute; left: 50%; top: 45%; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px;
  background: var(--panel-solid); border: 1px solid var(--line); font-weight: 700; }
#hd-conn.hidden { display: none; }

/* Gałka pod palcem (też myszą): środek w miejscu dotknięcia. */
#hd-stick { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .3); display: grid; place-items: center; }
#hd-stick.hidden { display: none; }
#hd-knob { width: 48px; height: 48px; border-radius: 50%; background: rgba(254, 200, 0, .55); border: 2px solid rgba(255, 255, 255, .7); }

/* Okna: awans, pauza, koniec gry. */
#hd-modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 2, 18, .55); padding: 12px; }
#hd-modal.hidden { display: none; }
.hd-box { width: min(760px, 96vw); max-height: 92%; overflow-y: auto; padding: 18px 20px; border-radius: 16px; text-align: center;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.hd-box h2 { margin: 0 0 4px; color: var(--gold); }
.hd-box p { margin: 6px 0; }
.hd-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.hd-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px 12px; min-width: 0;
  border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); box-shadow: none; text-transform: none; }
.hd-option:hover { border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--gold-rgb), .3); }
.hd-opt-key { position: absolute; left: 8px; top: 6px; font-size: 11px; color: var(--muted); }
.hd-opt-icon { font-size: 34px; line-height: 1.1; }
.hd-opt-name { font-weight: 900; color: #fff; font-size: 15px; }
.hd-opt-tag { font-size: 11.5px; font-weight: 800; color: var(--gold); min-height: 14px; }
.hd-opt-desc { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.hd-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.hd-end-stats { font-size: 16px; font-weight: 700; }
.hd-end-best { color: var(--gold); font-weight: 900; }
.hd-end-xp { font-size: 18px; font-weight: 900; color: #8fe3ff; }

/* Wybór bohatera (okno w menu). */
.modal.hd-heroes-modal { position: relative; width: min(900px, 96vw); max-height: 90dvh; overflow-y: auto; padding: 22px 24px; }
.hd-hero-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.hd-hero { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 14px; min-width: 0;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); box-shadow: none; text-transform: none; }
.hd-hero:hover, .hd-hero.last { border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--gold-rgb), .25); }
.hd-hero-art { width: 72px; height: 100px; border-radius: 8px; background: #1a0a30 center 20% / cover; border: 1px solid rgba(255, 255, 255, .25); }
.hd-hero-name { font-weight: 800; color: var(--gold); font-size: 13.5px; text-align: center; overflow-wrap: anywhere; }
.hd-hero-spell { font-size: 12.5px; color: #fff; }
.hd-hero-bonus { font-size: 11.5px; color: var(--muted); min-height: 14px; }

@media (max-width: 760px) {
  .hd-options { grid-template-columns: 1fr; }
  .hd-option { display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; row-gap: 1px; text-align: left; align-items: center; padding: 8px 12px; }
  .hd-opt-icon { grid-row: 1 / span 3; font-size: 28px; text-align: center; }
  .hd-opt-key { display: none; }
  .modal.hd-heroes-modal { padding: 16px 10px; }
  .hd-hero-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #hd-time { font-size: 20px; }
}
