:root {
  --a: #d4553f;
  --b: #4f86d6;
  --tlo: #14171c;
  --papier: #e9e2d4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--tlo);
  color: var(--papier);
  font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  user-select: none;
}

#gra { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.schowane { display: none !important; }

/* --- nakładki --- */

.nakladka {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(10,12,15,.72), rgba(8,9,12,.94));
  backdrop-filter: blur(3px);
}

.karta {
  width: min(560px, 92vw);
  padding: 32px 34px;
  background: linear-gradient(180deg, #1e232b, #171b21);
  border: 1px solid #333b47;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  text-align: center;
}
.karta.waska { width: min(340px, 88vw); padding: 22px; }

h1 {
  margin: 0 0 4px;
  font-size: 54px; letter-spacing: 10px; font-weight: 800;
  background: linear-gradient(180deg, #f0e3c8, #b99b62);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: 4px; }

.podtytul { margin: 0 0 22px; color: #97a2b0; font-size: 14px; letter-spacing: .5px; }

.pole { display: flex; gap: 10px; }

#nick {
  flex: 1; padding: 13px 15px; font-size: 16px;
  background: #10141a; color: var(--papier);
  border: 1px solid #39424f; border-radius: 9px; outline: none;
}
#nick:focus { border-color: #6f7f95; }

#graj {
  padding: 13px 26px; font-size: 15px; font-weight: 700; letter-spacing: 2px;
  background: linear-gradient(180deg, #c9a15c, #9a7333);
  color: #1c1710; border: 0; border-radius: 9px; cursor: pointer;
}
#graj:hover { filter: brightness(1.1); }

.zasady {
  margin: 20px 0 14px; padding: 14px 0; font-size: 13px; line-height: 2;
  color: #aab4c1; border-top: 1px solid #2b323c; border-bottom: 1px solid #2b323c;
}
.zasady b { color: var(--papier); }

.uwaga { margin: 0; font-size: 12.5px; line-height: 1.65; color: #7d879a; }

/* --- HUD --- */

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

#gora {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 26px; align-items: center;
  font-size: 13px; letter-spacing: 2px;
  text-shadow: 0 2px 6px rgba(0,0,0,.9);
}
.wynik b { font-size: 26px; margin: 0 6px; }
.druzyna-a { color: var(--a); }
.druzyna-b { color: var(--b); }

#komunikaty {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  width: min(520px, 90vw); text-align: center;
  font-size: 13.5px; line-height: 1.9;
  text-shadow: 0 2px 6px rgba(0,0,0,.9);
  color: #c8d0da;
}
#komunikaty .to-ja { color: #ffd479; }
#komunikaty .blad { color: #ff9b8a; }

#dol {
  position: absolute; left: 26px; bottom: 24px;
  display: flex; align-items: center; gap: 14px;
}
#zdrowie { display: flex; align-items: center; gap: 10px; }
#hp-tlo {
  width: 190px; height: 12px; border-radius: 7px;
  background: rgba(0,0,0,.55);
  border: 1px solid #3a4250; overflow: hidden;
}
#hp-pasek {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #b8452f, #e0a63f);
  transition: width .16s ease-out;
}
#hp-liczba { font-size: 20px; font-weight: 700; text-shadow: 0 2px 5px #000; }
#opis { font-size: 12px; letter-spacing: 2px; color: #96a1af; display: flex; gap: 12px; }

#przyciski {
  position: absolute; right: 20px; top: 16px;
  display: flex; gap: 8px; pointer-events: auto;
}
#przyciski button {
  width: 42px; height: 42px; font-size: 19px;
  background: rgba(20,24,30,.8); color: var(--papier);
  border: 1px solid #3a4250; border-radius: 10px; cursor: pointer;
}

#krew {
  position: fixed; inset: 0; z-index: 15; pointer-events: none; opacity: 0;
  transition: opacity .18s;
  background: radial-gradient(circle at 50% 50%, rgba(150,20,10,0) 35%, rgba(150,18,10,.85) 100%);
}

/* --- tablica wyników --- */

#tablica table {
  border-collapse: collapse; min-width: 340px;
  background: rgba(18,22,28,.94);
  border: 1px solid #333b47; border-radius: 10px; overflow: hidden;
}
#tablica th, #tablica td {
  padding: 9px 20px; text-align: left; font-size: 14px;
  border-bottom: 1px solid #262c35;
}
#tablica th { font-size: 11px; letter-spacing: 2px; color: #8b95a3; font-weight: 600; }
#tablica tr.to-ja { background: rgba(200,160,80,.13); }

/* Przycisk mikrofonu dokłada voice.js — moduł przyszedł z gry, w której
   siedział w rozwijanym menu, więc niesie ze sobą podpis i opis. Tutaj jest
   ikoną w rogu ekranu, więc tekst chowamy (zostaje w tooltipie). */
#voice-btn {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; padding: 0; font-size: 19px; line-height: 1;
  background: rgba(20,24,30,.82); color: var(--papier);
  border: 1px solid #3a4250; border-radius: 10px; cursor: pointer;
}
#voice-btn span, #voice-btn i { display: none; }
#voice-btn:hover { border-color: #6f7f95; }

#kursor-info {
  position: absolute; left: 50%; top: 66%; transform: translateX(-50%);
  padding: 9px 20px; border-radius: 20px;
  background: rgba(14,17,22,.72); border: 1px solid #3a4250;
  font-size: 13px; letter-spacing: 1.5px; color: #b9c3d0;
  pointer-events: none;
}

/* --- powtórka trafienia (kill cam) ---
   Sam obraz rysuje WebGL prosto w tym miejscu ekranu (scissor + viewport),
   więc ta ramka jest pusta — daje tylko obwódkę i podpis pod spodem. */
#killcam {
  position: absolute; right: 16px; top: 16px;
  border: 1px solid #5a6472; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden;
}
#killcam-opis {
  height: 22px; line-height: 22px; padding: 0 10px;
  background: rgba(12,15,20,.82);
  font-size: 11.5px; letter-spacing: 1px; color: #cfd7e2;
  border-top: 1px solid #39424f;
}
#killcam-opis b { color: #ffd479; }

/* --- panel wspólnych nastaw --- */
#panel {
  position: absolute; left: 16px; top: 16px; width: 260px;
  background: rgba(14,17,22,.86);
  border: 1px solid #39424f; border-radius: 10px;
  pointer-events: auto;
  font-size: 12px;
  overflow: hidden;
}
#panel-naglowek {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 12px; cursor: pointer;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid #2b323c;
  letter-spacing: 2px; font-weight: 700; font-size: 11px;
}
#panel-naglowek em { font-style: normal; font-size: 10px; letter-spacing: .5px; color: #7d879a; }
#panel.zwiniety #panel-suwaki, #panel.zwiniety #panel-reset { display: none; }
#panel-naglowek::after { content: '▾'; margin-left: auto; color: #7d879a; }
#panel.zwiniety #panel-naglowek::after { content: '▸'; }

#panel-suwaki { padding: 8px 12px 4px; max-height: 52vh; overflow-y: auto; }
.nastawa { display: grid; grid-template-columns: 1fr auto; align-items: center; margin-bottom: 7px; }
.nastawa .nazwa { color: #aab4c1; }
.nastawa .wartosc { color: #e9e2d4; font-variant-numeric: tabular-nums; }
.nastawa input[type="range"] {
  grid-column: 1 / -1; width: 100%; height: 16px; margin: 1px 0 0; cursor: pointer;
  accent-color: #c9a15c;
}
#panel-reset {
  display: block; width: calc(100% - 24px); margin: 4px 12px 10px; padding: 6px;
  background: rgba(255,255,255,.06); color: #cfd7e2;
  border: 1px solid #39424f; border-radius: 7px; cursor: pointer; font-size: 11px;
}
#panel-reset:hover { border-color: #6f7f95; }

#komunikaty .arena { color: #8fd0ff; }
#komunikaty .nastawa { color: #c9a15c; }

#stan-areny {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: baseline;
  font-size: 11px; letter-spacing: 2px; color: #8a94a3;
  text-shadow: 0 2px 6px rgba(0,0,0,.9);
}
#dystans { color: #cfd7e2; font-size: 13px; }

/* --- celownik --- */
#celownik {
  position: absolute; left: 50%; top: 50%;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  pointer-events: none;
  opacity: .75;
}
#celownik b {
  position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px;
  background: #f2e9d8; border-radius: 50%;
  box-shadow: 0 0 3px rgba(0,0,0,.9);
}
#celownik i {
  position: absolute; background: #f2e9d8;
  box-shadow: 0 0 3px rgba(0,0,0,.9);
}
/* cztery kreski dookoła, z przerwą w środku — nie zasłaniają celu */
#celownik i:nth-child(1) { left: 50%; top: 0;    width: 1px; height: 7px; margin-left: -.5px; }
#celownik i:nth-child(2) { left: 50%; bottom: 0; width: 1px; height: 7px; margin-left: -.5px; }
#celownik i:nth-child(3) { top: 50%; left: 0;    height: 1px; width: 7px; margin-top: -.5px; }
#celownik i:nth-child(4) { top: 50%; right: 0;   height: 1px; width: 7px; margin-top: -.5px; }

/* Przy ładowaniu celownik lekko rozchodzi się na boki — to samo, co robi
   drżąca broń: podpowiada, że coś się dzieje, nie zdradzając ile. */
#celownik.laduje { opacity: .95; transform: scale(1.45); transition: transform .12s linear; }

/* --- broń ze skrzyni --- */
#bron-hud {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  min-width: 190px; padding: 7px 14px 9px;
  background: rgba(14,17,22,.82);
  border: 1px solid #c9a15c; border-radius: 9px;
  text-align: center;
}
#bron-nazwa { font-size: 12px; letter-spacing: 2px; color: #f2e9d8; }
#bron-tlo { margin-top: 6px; height: 3px; background: rgba(0,0,0,.5); border-radius: 2px; overflow: hidden; }
#bron-czas { height: 100%; width: 100%; background: currentColor; color: #f0c674; transition: width .1s linear; }
#komunikaty .skrzynia { color: #ffb35c; }


/* Ekran śmierci nie może przerywać zabawy suwakami: pokazujemy sam baner
   u góry, bez pełnoekranowej zasłony i bez przechwytywania kliknięć.
   Wcześniej nakładka zjadała każdy ruch myszą nad panelem — a śmierć w tej
   grze zdarza się co kilkanaście sekund. */
#smierc {
  position: absolute; inset: auto 0 auto 0; top: 22%;
  background: none; backdrop-filter: none;
  pointer-events: none;
  z-index: 12;
}
#smierc .karta {
  background: rgba(20,12,12,.86);
  border-color: #7a3a34;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
}

/* Panel musi być NAD ekranem śmierci — inaczej nie da się nim kręcić leżąc. */
#panel { z-index: 14; }

.nastawa.przelacznik {
  grid-template-columns: 1fr auto; align-items: center; margin-bottom: 9px;
}
.nastawa.przelacznik input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: #c9a15c; cursor: pointer; margin: 0;
}

#blysk {
  position: fixed; inset: 0; z-index: 16; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fff 0%, #ffd9a0 45%, rgba(255,190,120,0) 75%);
  transition: opacity .16s ease-out;
}
#komunikaty .wybuch { color: #ffb35c; font-weight: 700; }
