/* Zombi Fogó — éjszakai raktár-parti UI (desktop fókusz) */

:root {
  --zombi: #7bd35c;
  --zombi-dark: #3f8a2e;
  --warm: #ff8a3c;
  --warm-dark: #b5591a;
  --gold: #ffc93c;
  --danger: #e5433f;
  --panel-bg: rgba(18, 24, 16, 0.92);
  --hud-bg: rgba(12, 18, 10, 0.62);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #171c13;
  font-family: 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

/* iOS Safari: a body-szintű user-select:none blokkolja az input fókuszát */
input,
textarea {
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}

.hidden {
  display: none !important;
}

/* --- Canvas: teljes képernyő; touch-action CSAK a canvasra --- */

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* --- Képernyők (join / lobby / end) --- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(123, 211, 92, 0.12), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(255, 138, 60, 0.1), transparent 55%),
    rgba(8, 12, 6, 0.78);
  animation: screenFade 0.35s ease-out;
}

@keyframes screenFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel {
  background: var(--panel-bg);
  border: 4px solid var(--zombi);
  border-radius: 24px;
  padding: 42px 56px;
  text-align: center;
  min-width: 380px;
  max-width: 640px;
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, 0.35),
    0 18px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 40px rgba(123, 211, 92, 0.07);
  animation: panelPop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes panelPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.title {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.05;
  color: var(--zombi);
  text-shadow:
    0 3px 0 var(--zombi-dark),
    0 8px 24px rgba(123, 211, 92, 0.5);
  transform: rotate(-2deg);
  margin-bottom: 6px;
}

.title-accent {
  display: block;
  color: var(--warm);
  text-shadow:
    0 3px 0 var(--warm-dark),
    0 8px 24px rgba(255, 138, 60, 0.45);
}

.tagline {
  font-size: 16px;
  color: #d5ecc8;
  margin-bottom: 28px;
  font-style: italic;
}

.panel-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--zombi);
  text-shadow: 0 3px 0 var(--zombi-dark), 0 6px 20px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
}

#name-input {
  display: block;
  width: 100%;
  padding: 14px 18px;
  font-size: 20px;
  border: 3px solid var(--zombi-dark);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #1c2916;
  margin-bottom: 18px;
  outline: none;
  text-align: center;
  font-weight: 700;
}

#name-input:focus {
  border-color: var(--zombi);
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--zombi), var(--zombi-dark));
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 2px;
  padding: 12px 26px;
  box-shadow: 0 5px 0 #2a5c1f, 0 8px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2a5c1f;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.btn-big {
  font-size: 26px;
  padding: 14px 44px;
  background: linear-gradient(180deg, #ffa95e, #d96a16);
  box-shadow: 0 5px 0 #96470a, 0 8px 18px rgba(0, 0, 0, 0.4);
}

.btn-big:active {
  box-shadow: 0 2px 0 #96470a;
}

.lobby-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 14px 0;
}

.hint {
  font-size: 13px;
  color: #a8c99a;
  margin-top: 14px;
}

#player-list {
  list-style: none;
  margin-bottom: 8px;
  column-count: 2;
  column-gap: 30px;
}

#player-list li {
  font-size: 18px;
  font-weight: 700;
  padding: 6px 0;
  border-bottom: 1px solid rgba(123, 211, 92, 0.2);
  break-inside: avoid;
}

/* --- Countdown --- */

#countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  font-size: 160px;
  font-weight: 900;
  color: var(--zombi);
  text-shadow: 0 6px 0 var(--zombi-dark), 0 14px 50px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#countdown-overlay.pop {
  animation: countPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes countPop {
  from { transform: scale(1.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Game HUD --- */

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

#topbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--hud-bg);
  border-radius: 14px;
  padding: 8px 22px;
}

#round-ind {
  font-size: 15px;
  font-weight: 900;
  color: #cfe8bf;
  letter-spacing: 1px;
}

#time-ind {
  font-size: 30px;
  font-weight: 900;
  color: #fff;
  min-width: 92px;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

#time-ind.urgent {
  color: var(--danger);
  animation: urgentPulse 0.6s infinite alternate;
}

@keyframes urgentPulse {
  from { opacity: 0.75; }
  to { opacity: 1; }
}

#alive-ind {
  font-size: 16px;
  font-weight: 900;
}

#alive-ind .surv {
  color: var(--warm);
}

#alive-ind .zomb {
  color: var(--zombi);
}

#scoreboard {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--hud-bg);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 200px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  font-weight: 700;
  padding: 2px 0;
}

.score-row.me .sr-name {
  color: var(--gold);
}

.score-row.zombi .sr-name {
  color: #9fdd85;
}

.sr-pts {
  color: #d8ecc8;
}

#infect-feed {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.feed-entry {
  background: var(--hud-bg);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  animation: kfIn 0.25s ease-out;
}

.feed-entry .z {
  color: var(--zombi);
}

@keyframes kfIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 54px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 0 4px 0 #7a5a00, 0 10px 34px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
}

.banner.zombi {
  color: var(--zombi);
  text-shadow: 0 4px 0 var(--zombi-dark), 0 10px 34px rgba(0, 0, 0, 0.6);
}

.banner.warm {
  color: var(--warm);
  text-shadow: 0 4px 0 var(--warm-dark), 0 10px 34px rgba(0, 0, 0, 0.6);
}

.banner.danger {
  color: var(--danger);
  text-shadow: 0 4px 0 #7a1410, 0 10px 34px rgba(0, 0, 0, 0.6);
}

.banner.pop {
  animation: bannerPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes bannerPop {
  from { transform: translateX(-50%) scale(1.6); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

#powerup-ind {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hud-bg);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 26px;
  display: flex;
  gap: 10px;
}

#inter-overlay {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

#inter-count {
  font-size: 90px;
  color: var(--zombi);
  text-shadow: 0 5px 0 var(--zombi-dark), 0 10px 34px rgba(0, 0, 0, 0.6);
}

/* --- Kör vége overlay --- */

#roundend-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
}

.re-panel {
  background: var(--panel-bg);
  border: 3px solid var(--zombi);
  border-radius: 18px;
  padding: 26px 40px;
  text-align: center;
  animation: panelPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

#roundend-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 14px;
  text-shadow: 0 2px 0 #7a5a00;
}

.re-row {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  font-size: 17px;
  font-weight: 700;
  padding: 3px 0;
}

.re-row.me {
  color: var(--gold);
}

/* --- Dobogó --- */

#podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 130px;
}

.podium-av {
  font-size: 42px;
  animation: bounceAv 1s infinite alternate ease-in-out;
}

@keyframes bounceAv {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.podium-name {
  font-weight: 900;
  font-size: 16px;
  margin: 4px 0;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-block {
  width: 100%;
  background: linear-gradient(180deg, var(--zombi), var(--zombi-dark));
  border-radius: 8px 8px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

.place-1 .podium-block {
  background: linear-gradient(180deg, #ffd75e, #d9a616);
}

.podium-rest {
  width: 100%;
  margin-top: 12px;
  font-size: 15px;
  color: #c8e0b8;
}

/* --- Kapcsolat-státusz --- */

#conn-status {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(180, 40, 30, 0.92);
  padding: 8px 22px;
  border-radius: 20px;
  font-weight: 700;
  animation: connPulse 1.2s infinite alternate;
}

@keyframes connPulse {
  from { opacity: 0.75; }
  to { opacity: 1; }
}

/* Visszalink a játékválasztóra — meccs közben rejtve */
#home-link {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 30;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #fff;
  opacity: 0.55;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}
#home-link:hover { opacity: 1; }
body:has(#screen-game:not(.hidden)) #home-link { display: none; }
