/* Tower Defence: ekran gry (HUD, plansza, ręka, okienka), wybór talii i okno przygody. */

/* Tower Defence – „Hej, przygodo!”: okno misji (rangi z bossem i nowymi kartami) */
.td-adv-next { color: var(--gold); font-weight: 700; }
.modal.td-adv-modal { position: relative; width: min(900px, 96vw); max-height: 90dvh; overflow-y: auto; padding: 22px 24px; }
.td-adv-about { max-width: 640px; margin: 0 auto 14px; font-size: 14px; }
.td-adv-modal .td-adv-ranks { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* Wybór talii przed grą endless */
.modal.td-deck-modal { position: relative; width: min(760px, 96vw); max-height: 90dvh; overflow-y: auto; padding: 22px 24px; }
.td-deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.td-deck { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border-radius: 14px; min-width: 0;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); box-shadow: none; }
.td-deck:hover { border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--gold-rgb), .25); }
.td-deck-cover { width: 64px; height: 88px; border-radius: 8px; background: #1a0a30 center 20% / cover; display: grid; place-items: center; font-size: 34px;
  border: 1px solid rgba(255, 255, 255, .25); }
.td-deck-name { font-weight: 800; color: var(--gold); font-size: 14px; text-align: center; overflow-wrap: anywhere; }
.td-deck-sub { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .td-adv-modal .td-adv-ranks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.td-adv-ranks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.td-rank {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); box-shadow: none; min-width: 0;
}
.td-rank:hover:not(:disabled) { border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--gold-rgb), .25); }
.td-rank.current { border-color: var(--gold); }
.td-rank.done { background: rgba(80, 200, 120, .08); }
.td-rank.locked { opacity: .45; filter: grayscale(.8); }
.td-rank-n { font-weight: 800; color: var(--gold); font-size: 14px; }
.td-rank-boss { height: 34px; display: flex; align-items: flex-end; }
.td-rank-name { font-size: 12.5px; font-weight: 700; line-height: 1.2; text-align: center; }
.td-rank-cards { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.td-rank-cards img { width: 26px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .25); }
.td-rank-tags { font-size: 11.5px; color: var(--muted); min-height: 14px; }
@media (max-width: 760px) {
  .modal.td-adv-modal { padding: 16px 10px; }
  .td-adv-modal .td-adv-ranks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
/* Ekran gry: pasek, opis, plansza (canvas) i ręka. */
#screen-tower { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
#screen-tower.hidden { display: none; }
#td-hud { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#td-stats { flex: 1; min-width: 0; font-weight: 800; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#td-bottom { display: flex; gap: 8px; align-items: stretch; min-height: 0; }
#td-bottom #td-hand { flex: 1; min-width: 0; scrollbar-width: none; }
#td-bottom #td-hand::-webkit-scrollbar { display: none; }
.td-hand-nav { flex: none; width: 34px; padding: 0; border-radius: 10px; font-size: 16px; background: rgba(255, 255, 255, .1); color: var(--gold); }
.td-hand-nav:disabled { opacity: .25; cursor: default; }
.td-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; transition: none !important; will-change: transform; --card-h: 110px; --card-w: 79px; opacity: .9; filter: drop-shadow(0 8px 14px rgba(0,0,0,.5)); }
#td-bottom.td-drop #td-hand { outline: 3px dashed var(--gold); outline-offset: -3px; border-radius: 12px; background: rgba(254, 200, 0, .08); }
/* Przyciski na planszy (nad mapą): fala – prawy dolny róg, przyspieszenie – na dole pośrodku */
#td-wave { position: absolute; right: 10px; bottom: 10px; z-index: 3; min-width: 150px; min-height: 48px; padding: 8px 20px; border-radius: 14px;
  font-size: 17px; font-weight: 900; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
#td-speed { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; display: flex; gap: 2px; padding: 3px;
  border-radius: 999px; background: rgba(15, 8, 25, .82); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
#td-speed button { min-width: 42px; padding: 5px 9px; border-radius: 999px; background: transparent; box-shadow: none; color: #fff;
  font-size: 14px; font-weight: 900; }
#td-speed button:hover { background: rgba(255, 255, 255, .12); }
#td-speed button.active { background: var(--gold); color: #2a0a40; }
#td-speed.hidden, #td-start.hidden { display: none; }
/* Poziomy kart (trening): kółko siły – 1 jasnobrązowe, 2 srebrne, 3 złote (ramka karty bez zmian) */
.card.card.td-lvl1 .power { background: radial-gradient(circle at 35% 30%, #f3e0c8, #c9a27e 55%, #7d5a38); }
.card.card.td-lvl2 .power { background: radial-gradient(circle at 35% 30%, #ffffff, #d9dfe6 55%, #8a95a3); }
.card.card.td-lvl3 .power { background: radial-gradient(circle at 35% 30%, #fff6c8, #fec800 55%, #9a6e10); }
.card.card[class*="td-lvl"] .power { color: #1b130d; text-shadow: none; }   /* liczba siły zawsze czarna (też karty „na stół wroga”) */
/* Trening – kwadraciki postępu na karcie (z lewej, pod siłą): pionowo po 4, zielone – przetrwane fale */
.card .td-train { position: absolute; left: .32em; top: 2.25em; z-index: 2; display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, .52em);
  grid-auto-columns: .52em; gap: .14em; }
.card .td-train i { border: .07em solid rgba(255, 255, 255, .85); border-radius: .1em; background: rgba(0, 0, 0, .3); box-shadow: 0 0 2px rgba(0, 0, 0, .8); }
.card .td-train i.on { background: #5ef07a; }
.td-train-act button { white-space: nowrap; }
/* Podsumowanie fali – na środku planszy, zamykane przyciskiem OK */
.td-summary { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 26; width: min(360px, calc(100% - 20px));
  max-height: calc(100% - 140px); overflow: auto; padding: 10px 12px; border-radius: 14px; background: var(--panel-solid);
  border: 1px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); font-size: 13px; }
.td-sum-stats { display: grid; gap: 3px; margin-bottom: 10px; }
.td-sum-stat { display: grid; grid-template-columns: 1.5em 1fr auto; align-items: center; gap: 6px; }
.td-sum-stat.bad b { color: #ff8a7a; }
.td-sum-stat.sum { border-top: 1px solid var(--line); padding-top: 3px; }
.td-sum-stat.sum b { color: var(--gold); }
.td-sum-top { display: grid; gap: 3px; }
.td-sum-row { display: grid; grid-template-columns: 1.7em minmax(0, 1fr) 70px auto; align-items: center; gap: 6px; }
.td-sum-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sum-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.td-sum-ok { display: block; margin: 12px auto 0; min-width: 120px; }
.td-sum-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9a5a, #ffd65a); }
/* Ustawienia – przycisk ⚙ w lewym dolnym rogu (obok licznika FPS), panel nad nim */
#td-settings { position: absolute; left: 6px; bottom: 26px; z-index: 4; }   /* razem z licznikiem FPS – nad głowami postaci z kart ręki */
.td-settings-btn { width: 22px; height: 22px; min-width: 0; padding: 0; border-radius: 6px; font-size: 14px; line-height: 1;
  background: rgba(0, 0, 0, .55); box-shadow: none; color: #fff; }
.td-settings-panel { position: absolute; left: 0; bottom: 28px; padding: 8px 10px; border-radius: 10px; white-space: nowrap;
  background: rgba(15, 8, 25, .94); box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, .5); color: #fff; font-size: 13px; font-weight: 700; }
.td-settings-panel.hidden { display: none; }
.td-settings-panel label { display: flex; align-items: center; gap: 8px; }
.td-settings-panel select { padding: 3px 6px; border-radius: 6px; font-size: 13px; }
#td-start { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; display: flex; gap: 8px; padding: 6px;
  border-radius: 999px; background: rgba(15, 8, 25, .82); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
#td-start button { min-width: 110px; padding: 8px 18px; border-radius: 999px; font-size: 16px; font-weight: 900; }
#td-start button.hidden { display: none; }
#td-wave.confirm { background: #e5533d; box-shadow: 0 0 0 3px #ffd65a; }
.td-remind { position: absolute; right: 10px; bottom: 70px; z-index: 3; padding: 8px 20px; border-radius: 16px; background: rgba(20, 8, 30, .9); color: #ffd27a;
  font-size: 24px; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); min-height: 0; animation: td-remind 2.4s ease-in-out infinite; }
.td-remind::after { content: ''; position: absolute; right: 30px; bottom: -10px; border: 10px solid transparent; border-bottom: 0; border-top-color: rgba(20, 8, 30, .9); }
.td-remind.hidden { display: none; }
@keyframes td-remind { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
#td-board { flex: 1; min-height: 0; position: relative; border-radius: 12px; overflow: hidden; background: #142816; border: 1px solid var(--line); }
#td-canvas { position: absolute; inset: 0; touch-action: none; }
#td-hand { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; min-height: 146px; align-items: center; }
#td-hand .card { --card-h: 134px; --card-w: 96px; cursor: grab; touch-action: pan-x; }
.card.td-ghost { overflow: visible; }   /* przeciągana karta – postać wystaje nad nią (zdjęcie ma własne zaokrąglenie) */
#td-bottom { position: relative; }
#td-sits { position: absolute; inset: 0; z-index: 30; pointer-events: none; }   /* postacie z kart ręki – wystają nad kartami na planszę */
#td-sits .td-sit { position: absolute; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.card .td-sit { position: absolute; left: 50%; top: 0; height: 40%; width: auto; z-index: 2; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
   /* poziomo – przewijanie ręki, w górę – przeciąganie na pole */
#td-hand .card.td-dragged { opacity: .35; }
#td-hand .card.td-marked { box-shadow: 0 0 0 3px #ff5a4a, 0 0 14px rgba(255, 90, 74, .7); transform: translateY(-4px); }
#td-hand .card.td-marked::after { content: '🔨'; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 3; font-size: 2.6em;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .8)); pointer-events: none; }
/* Ikona miejsca na karcie: ⚔ wojownik (polana), 🏹 strzelec (skarpa) – lewa krawędź pod mocą */
.card .td-kind { position: absolute; left: 4px; top: calc(var(--card-h) * .3); z-index: 2; width: calc(var(--card-w) * .3); height: calc(var(--card-w) * .3);
  display: grid; place-items: center; border-radius: 50%; font-size: calc(var(--card-w) * .17); line-height: 1;
  background: rgba(15, 8, 25, .85); box-shadow: 0 0 0 2px var(--kind-color); pointer-events: none; }
.card .td-kind.melee { --kind-color: #9be36b; color: #dfffcc; font-weight: 900; font-size: calc(var(--card-w) * .2); }
.card .td-kind.ranged { --kind-color: #8cc4ff; }
/* HUD na planszy: lewo – przeciwnicy fali, środek – fala, prawo – życia, donate */
#td-overlay { position: absolute; inset: 8px 8px auto 8px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; pointer-events: none; z-index: 2; }
.td-ov { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.td-ov:empty { display: none; }
/* Przeciwnicy fali – w pionie, w lewym górnym rogu; po najechaniu statystyki potwora */
#td-enemies { justify-self: start; flex-direction: column; align-items: flex-start; gap: 5px; pointer-events: auto; }
.td-enemy { position: relative; cursor: help; }
.td-enemy-tip { display: none; position: absolute; left: calc(100% + 6px); top: 0; z-index: 5; white-space: nowrap; padding: 6px 10px;
  border-radius: 10px; background: rgba(15, 8, 25, .94); box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, .5);
  font-size: 13px; font-weight: 600; line-height: 1.45; color: #fff; }
.td-enemy-tip b { font-size: 14px; color: var(--gold); }
.td-enemy:hover .td-enemy-tip { display: block; }
#td-wavebox { justify-self: center; flex-direction: row; flex-wrap: nowrap; white-space: nowrap; align-items: stretch; gap: 0; padding: 0; overflow: hidden; border-radius: 12px; background: rgba(15, 8, 25, .78); color: var(--gold); font-weight: 900; font-size: 18px; line-height: 1.1; }
#td-wavebox small { font-size: 11px; font-weight: 700; color: var(--muted); }
.td-wave-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 16px; }
#td-wavebox .td-wave-clock { font-variant-numeric: tabular-nums; }
#td-wavebox .td-wave-clock.urgent { color: #ff8a7a; font-weight: 800; }
.td-wpow { display: flex; align-items: center; padding: 0 12px; font-size: 15px; background: rgba(0, 0, 0, .3); }
.td-wpow-wave { color: #ff9a8a; border-right: 1px solid rgba(255, 255, 255, .12); }
.td-power { color: var(--pow); border-left: 1px solid rgba(255, 255, 255, .12); box-shadow: inset 0 -3px 0 var(--pow); }
/* Statystyki (życia, złoto, zabójstwa, talia, kowal) – w pionie, większe, w prawym górnym rogu planszy */
#td-res { justify-self: end; flex-direction: column; align-items: stretch; gap: 5px; }
#td-overlay #td-res > span { justify-content: flex-start; min-width: 100px; padding: 6px 14px; font-size: 20px; }
#td-overlay #td-res .td-ov-dim { font-size: 20px; color: #fff; }
#td-res .td-ic { display: inline-block; width: 1.35em; text-align: center; font-style: normal; font-size: .95em; line-height: 1; }
#td-res b { font-weight: 800; }
#td-res > span, .td-enemy { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(15, 8, 25, .78); color: #fff; font-weight: 800; font-size: 15px; }
#td-res .td-ov-dim { font-size: 13px; color: var(--muted); }
/* Zakładka pod złotem – złoto po fali */
#td-overlay #td-res > .td-gold { border-bottom-right-radius: 4px; }
#td-overlay #td-res > .td-income { align-self: flex-end; min-width: 0; margin-top: -5px; padding: 1px 8px 2px; border-radius: 0 0 9px 9px;
  font-size: 12px; font-weight: 800; color: #ffd65a; cursor: help; }
/* Wiersze potworów – wspólne kolumny (subgrid): każda tak szeroka jak najszersza wartość, liczby jedna pod drugą */
#td-enemies { display: grid; grid-template-columns: repeat(6, auto); justify-content: start; row-gap: 3px; }
.td-enemy { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; column-gap: 5px; padding: 1px 7px 1px 5px; border-radius: 9px;
  font-size: 12px; font-weight: 800; line-height: 1.2; }
.td-enemy > b { font-size: 12px; }
.td-enemy > i { font-style: normal; white-space: nowrap; }
.td-enemy > .td-enemy-ic { display: flex; align-items: center; justify-content: center; height: 20px; }
.td-enemy .td-mon { transform: scale(.68); transform-origin: center; }
.td-enemy.boss { box-shadow: 0 0 0 2px #e5533d; }
.td-pow-ok { --pow: #5ef07a; }
.td-pow-near { --pow: #ffd65a; }
.td-pow-low { --pow: #ff6a5a; }
.td-enemy b { font-size: 14px; }
.td-mon { display: inline-block; height: 30px; background-repeat: no-repeat; image-rendering: pixelated; font-style: normal; }
#td-hand .card.selected { box-shadow: 0 0 0 3px var(--gold), 0 0 14px var(--gold); transform: translateY(-4px); }
.td-empty { padding: 0 8px; }
/* Okienko karty z ręki: postać (idle) + statystyki i umiejętności */
#td-card-tip { position: fixed; z-index: 60; display: flex; gap: 10px; width: min(380px, calc(100vw - 12px)); padding: 10px 12px; border-radius: 14px;
  background: rgba(15, 8, 25, .96); box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(0, 0, 0, .55); color: #fff; pointer-events: none; }
#td-card-tip.hidden { display: none; }
.td-tip-anim { flex: none; width: 90px; height: 118px; border-radius: 10px; background: radial-gradient(circle at 50% 75%, rgba(254, 200, 0, .14), transparent 70%); }
.td-tip-info { min-width: 0; font-size: 13px; line-height: 1.4; }
.td-tip-name { font-size: 16px; font-weight: 900; color: var(--gold); margin-bottom: 2px; }
.td-tip-stat { color: #e8e0f0; }
.td-tip-abs { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.td-tip-ab b { color: #ffd65a; }
#td-end { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(8, 2, 18, .65); }
#td-end.hidden { display: none; }
@media (max-width: 760px) {
  #screen-tower { padding: 6px 4px; gap: 4px; }
  #td-stats { font-size: 13px; }
  #td-wave { right: 6px; bottom: 6px; min-width: 88px; min-height: 36px; padding: 4px 10px; font-size: 13px; }
  .td-remind { right: 6px; bottom: 48px; padding: 4px 10px; font-size: 13px; border-radius: 10px; }
  .td-remind::after { right: 20px; bottom: -6px; border-width: 6px; border-bottom: 0; }
  #td-speed { bottom: 6px; }
  #td-speed button { min-width: 32px; padding: 4px 6px; font-size: 12px; }
  #td-hand { min-height: 116px; }   /* karta 104 + odstępy – pusta ręka tej samej wysokości (mapa nie skacze) */
  #td-hand .card { --card-h: 104px; --card-w: 75px; }
  #td-overlay { inset: 4px 4px auto 4px; gap: 4px; }
  #td-enemies, #td-res { max-width: 100%; gap: 4px; }
  #td-enemies { zoom: .4; }   /* 2,5× mniejsza – nie zasłania mapy (zoom zmniejsza też zajmowane miejsce) */
  #td-enemies.td-compact { grid-template-columns: repeat(3, auto); }
  #td-enemies.td-compact .td-enemy > i:nth-of-type(n+3) { display: none; }   /* tylko liczba, ikona i życie */
  #td-wavebox { font-size: 14px; }
  .td-wave-mid { padding: 3px 10px; }
  .td-wpow { padding: 0 8px; font-size: 12px; }
  #td-res > span, .td-enemy { font-size: 12px; padding: 2px 7px; }
  #td-res { gap: 3px; }
  #td-overlay #td-res > span { min-width: 66px; font-size: 15px; padding: 3px 9px; }
  #td-overlay #td-res .td-ov-dim { font-size: 15px; }
  .td-mon { height: 22px; }
}
/* Odznaki umiejętności TD na karcie (zamiast monety donate) */
.card .td-ab { position: absolute; top: .3em; right: .3em; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: .15em; }
.card .td-ab-chip { padding: .05em .35em; border-radius: .7em; background: rgba(15, 8, 25, .86); border: .08em solid rgba(255, 214, 90, .55);
  color: #fff; font-weight: 900; font-size: .78em; line-height: 1.35; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.card .td-ab-chip.boosted { color: #5ef07a; border-color: #5ef07a; }
#td-hand .card.td-boost { box-shadow: 0 0 0 2px #c39bff; }
#td-hand .card.td-melee { box-shadow: 0 0 0 2px #9be36b; }
#td-hand .card.td-boost.selected { box-shadow: 0 0 0 3px var(--gold), 0 0 14px var(--gold); }
#td-ridge-panel {
  position: absolute; left: 0; top: 0; z-index: 20; width: min(340px, calc(100% - 12px)); transform-origin: 0 0;
  padding: 10px 12px; border-radius: 14px;
  background: var(--panel-solid); border: 1px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
/* strzałka dymku do skarpy (--arrow – miejsce wzdłuż boku) */
#td-ridge-panel::after { content: ''; position: absolute; width: 14px; height: 14px; background: var(--panel-solid);
  border: 1px solid var(--gold); transform: rotate(45deg); }
#td-ridge-panel[data-side="top"]::after { left: calc(var(--arrow, 50%) - 7px); bottom: -8px; border-top: 0; border-left: 0; }
#td-ridge-panel[data-side="bottom"]::after { left: calc(var(--arrow, 50%) - 7px); top: -8px; border-bottom: 0; border-right: 0; }
#td-ridge-panel[data-side="left"]::after { top: calc(var(--arrow, 50%) - 7px); right: -8px; border-bottom: 0; border-left: 0; }
#td-ridge-panel[data-side="right"]::after { top: calc(var(--arrow, 50%) - 7px); left: -8px; border-top: 0; border-right: 0; }
#td-ridge-panel[data-side="far"]::after { display: none; }
#td-ridge-panel.hidden { display: none; }
#screen-tower { position: relative; }
.td-ridge-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; cursor: move; touch-action: none; user-select: none; }
#td-ridge-panel.wide { width: min(560px, calc(100% - 12px)); }
/* okno kowala */
.td-forge-bar { position: relative; height: 18px; border-radius: 9px; background: rgba(0, 0, 0, .45); overflow: hidden; margin: 2px 0 8px; }
.td-forge-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ff8c2a, #ffcc5c); }
.td-forge-bar span { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 800; line-height: 18px; }
.td-mini-bar { height: 15px; margin: 3px 0 0; }
.td-mini-bar span { font-size: 11px; line-height: 15px; }
.td-rules { display: grid; grid-template-columns: auto 1fr auto; gap: 3px 8px; align-items: center; margin: 0 0 8px; padding: 7px 9px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-size: 12.5px; }
.td-rules b { color: var(--gold); text-align: right; white-space: nowrap; }
.td-rules-title { grid-column: 1 / -1; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; opacity: .65; }
.td-rules-lead { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.td-rules-note { margin: 0 0 8px; font-size: 11.5px; opacity: .7; }
/* okno sklepikarza */
.td-shop-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.td-shop-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.td-shop-icon { font-size: 18px; width: 24px; text-align: center; }
.td-shop-name { flex: 1; font-size: 13px; font-weight: 700; text-align: left; }
.td-shop-item button { min-width: 78px; }
/* przycisk „Przerób” obok karty na stole kowala */
.td-forge-act { position: absolute; z-index: 15; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; pointer-events: none; }
.td-forge-act.hidden { display: none; }
.td-forge-act button { pointer-events: auto; padding: 6px 12px; font-size: 13px; box-shadow: 0 4px 12px rgba(0, 0, 0, .5); }
.td-forge-act button:disabled { background: #5a5560; color: #c9c4cf; filter: grayscale(1); cursor: default; }
.td-forge-btn { transform: translate(-100%, -50%); }   /* na lewo od pola na kartę, w połowie jego wysokości */
.td-forge-tip { color: #ffd27a; font-weight: 700; }
.td-forge-tip::before { content: '🔨 '; }
.td-place { display: grid; grid-template-columns: 1fr 170px; gap: 10px; }
.td-place-list { display: flex; flex-direction: column; gap: 6px; }
   /* do 5 kart – bez przewijania */
.td-place-unit { display: flex; gap: 8px; align-items: center; padding: 5px; border-radius: 10px; background: rgba(255, 255, 255, .06); cursor: pointer; }
.td-place-unit:hover { background: rgba(255, 255, 255, .12); }
.td-place-unit.active { box-shadow: 0 0 0 2px var(--gold); }
.td-place-unit .card { --card-h: 56px; --card-w: 40px; flex: none; }
.td-place-unit .card .td-kind { display: none; }
.td-place-info { min-width: 0; text-align: left; flex: 1; }
.td-place-wave { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin-left: auto; padding-left: 6px; font-weight: 800; font-size: 13px; white-space: nowrap; align-self: stretch; }
.td-place-statuses { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: auto; }
.td-st { padding: 1px 5px; border-radius: 6px; font-size: 11px; font-weight: 800; color: #fff; }
.td-wave-dmg { color: #ffd65a; }
.td-wave-def { color: #8cc4ff; }
.td-place-info b { display: block; font-size: 13px; }
.td-place-stats { color: var(--gold); font-weight: 700; }
.td-place-group { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-size: 13px; align-self: start; }
.td-place-line { display: flex; justify-content: space-between; gap: 8px; }
@media (max-width: 560px) {
  .td-place { grid-template-columns: 1fr; }
}
.td-ridge-head .pill { margin-left: auto; }
.td-ridge-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.td-ridge-card { display: flex; gap: 8px; align-items: center; width: calc(50% - 4px); padding: 6px; border-radius: 10px; background: rgba(255, 255, 255, .06); text-align: left; color: inherit; box-shadow: none; font-weight: 400; }
.td-ridge-card .card { --card-h: 64px; --card-w: 46px; flex: none; }
@media (max-width: 760px) {
  .td-ridge-card { width: 100%; }
  /* statystyki w osobnej linii pod przyciskami – nie ucina ich */
  #td-stats { flex: 1; }
  #td-hud { row-gap: 4px; }
}

/* Wąski telefon (~360 px): mniejszy HUD na planszy – więcej widać mapy. */
@media (max-width: 480px) {
  #td-wavebox { font-size: 12px; }
  .td-wave-mid { padding: 2px 6px; }
  .td-wpow { padding: 0 5px; font-size: 10px; }
  #td-wavebox small { font-size: 9px; }
  .td-enemy { font-size: 10px; padding: 1px 5px; }
  .td-mon { height: 16px; }
  #td-overlay #td-res > span { min-width: 52px; font-size: 12px; padding: 2px 7px; }
  #td-overlay #td-res .td-ov-dim { font-size: 12px; }
  #td-speed button { min-width: 28px; padding: 3px 5px; font-size: 11px; }
  #td-start { bottom: 6px; gap: 4px; padding: 4px; }
  #td-start button { min-width: 70px; padding: 6px 10px; font-size: 13px; }
  #td-bottom { gap: 4px; }
  .td-hand-nav { width: 24px; font-size: 13px; }
}
