/* Slime Liga — napfényes kocsonya-stadion UI (desktop fókusz) */

:root {
  --sky: #7ec8ef;
  --grass: #47a85c;
  --grass-dark: #2f7a41;
  --red: #ee5548;
  --red-dark: #a32b21;
  --blue: #3c8de0;
  --blue-dark: #1f5ba3;
  --gold: #ffc93c;
  --panel-bg: rgba(14, 32, 44, 0.92);
  --hud-bg: rgba(10, 24, 34, 0.62);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1b26;
  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 itt) --- */

#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(126, 200, 239, 0.16), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(71, 168, 92, 0.14), transparent 55%),
    rgba(6, 14, 20, 0.75);
  animation: screenFade 0.35s ease-out;
}

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

.panel {
  background: var(--panel-bg);
  border: 4px solid var(--grass);
  border-radius: 24px;
  padding: 40px 54px;
  text-align: center;
  min-width: 420px;
  max-width: 680px;
  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(71, 168, 92, 0.1);
  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: 58px;
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.05;
  color: var(--red);
  text-shadow:
    0 3px 0 var(--red-dark),
    0 8px 24px rgba(238, 85, 72, 0.45);
  transform: rotate(-2deg);
  margin-bottom: 6px;
}

.title-accent {
  color: var(--blue);
  text-shadow:
    0 3px 0 var(--blue-dark),
    0 8px 24px rgba(60, 141, 224, 0.45);
}

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

.panel-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 0 3px 0 #7a5a00, 0 6px 20px rgba(0, 0, 0, 0.5);
  margin-bottom: 18px;
}

.panel-title.ttl-red { color: var(--red); text-shadow: 0 3px 0 var(--red-dark); }
.panel-title.ttl-blue { color: var(--blue); text-shadow: 0 3px 0 var(--blue-dark); }

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

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

.btn {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--grass), var(--grass-dark));
  color: #fff;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 2px;
  padding: 12px 24px;
  box-shadow: 0 5px 0 #1c4a2a, 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 #1c4a2a;
}

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

.btn-big {
  font-size: 25px;
  padding: 14px 42px;
  background: linear-gradient(180deg, #ffd75e, #d9a616);
  box-shadow: 0 5px 0 #96700a, 0 8px 18px rgba(0, 0, 0, 0.4);
}

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

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

.hint {
  font-size: 13px;
  color: #9fc9dd;
  margin-top: 12px;
}

/* --- lobby csapat-oszlopok --- */

.team-lists {
  display: flex;
  gap: 14px;
  align-items: stretch;
  justify-content: center;
  margin-bottom: 8px;
}

.team-col {
  flex: 1;
  min-width: 170px;
  border-radius: 14px;
  padding: 12px 14px;
}

.team-col h3 {
  font-size: 18px;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.team-red {
  background: rgba(238, 85, 72, 0.14);
  border: 2px solid rgba(238, 85, 72, 0.55);
}

.team-red h3 { color: var(--red); }

.team-blue {
  background: rgba(60, 141, 224, 0.14);
  border: 2px solid rgba(60, 141, 224, 0.55);
}

.team-blue h3 { color: #7db8f0; }

.team-vs {
  align-self: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
}

.team-col ul {
  list-style: none;
  min-height: 60px;
}

.team-col li {
  font-size: 17px;
  font-weight: 700;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.team-col li.me {
  color: var(--gold);
}

/* --- 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(--gold);
  text-shadow: 0 6px 0 #7a5a00, 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;
}

#scorebar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hud-bg);
  border-radius: 14px;
  padding: 8px 20px 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.sb-team {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
}

.sb-score {
  font-size: 32px;
  font-weight: 900;
}

.sb-dash {
  font-size: 26px;
  color: #cfe8f5;
}

.sb-red { color: #ff9187; }
.sb-blue { color: #7db8f0; }

#sb-clock {
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #e8f4fa;
  letter-spacing: 1px;
}

#sb-ot {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold);
  animation: suddenPulse 0.6s infinite alternate;
}

@keyframes suddenPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

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

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

.gf-entry.gf-red { border-left: 4px solid var(--red); }
.gf-entry.gf-blue { border-left: 4px solid var(--blue); }

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

#kickoff-note {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 10px 34px rgba(0, 0, 0, 0.6);
  animation: suddenPulse 0.5s infinite alternate;
}

.banner {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 64px;
  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;
  z-index: 12;
}

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

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

.banner.gold { color: var(--gold); }

.banner.small {
  top: 36%;
  font-size: 36px;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 8px 26px 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; }
}

#goal-sub {
  position: absolute;
  top: 36%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
  z-index: 12;
}

/* --- Meccs vége --- */

#end-score {
  font-size: 60px;
  font-weight: 900;
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-bottom: 16px;
}

.es-red { color: var(--red); text-shadow: 0 3px 0 var(--red-dark); }
.es-blue { color: var(--blue); text-shadow: 0 3px 0 var(--blue-dark); }
.es-dash { color: #cfe8f5; }

#end-stats {
  max-width: 420px;
  margin: 0 auto;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  font-size: 17px;
  font-weight: 700;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row.st-red { border-left: 4px solid var(--red); }
.stat-row.st-blue { border-left: 4px solid var(--blue); }

/* --- 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; }
