/* turnaj.css */

/* turnaj je defaultně skrytý (během intra) */
#tournamentView {
  display: none;
}

#tournamentView.show {
  display: flex;
}


/* obecné skrytí prvků */
.hidden { display: none !important; }

/* ===== Zobrazení turnaje uprostřed stránky – bez pozadí ===== */
.tournament-view {
  text-align: center;
  color: white;

  flex-direction: column;
  align-items: center;
  gap: 8px;

  margin-top: 0;

  position: relative;
  top: -25px;

  z-index: 1;
}

/* ===== Název turnaje ===== */
.tournament-title {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-bottom: -14px;
  font-size: clamp(2.4rem, 6vw, 3.5rem);

  text-shadow: 0 0 35px rgba(120, 255, 220, 0.45);
}

/* ===== Trofej pod názvem ===== */
.t-trophy-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0px 0 0px;
  position: relative;
  z-index: 2;
}

.t-trophy-image {
  width: 160px;
  height: 160px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
  position: relative;
  z-index: 2;
}

/* ===== Datum + čas + místo (jeden řádek) ===== */
.tournament-date {
  margin-top: 6px;
}

.t-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.t-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 6px 12px;
  border-radius: 999px;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);

  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
  color: rgba(255,255,255,0.95);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.t-chip:hover {
  background: rgba(255,255,255,0.14);
  box-shadow: 0 0 18px rgba(120,255,220,0.25);
}

.t-ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

.t-ico svg {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

/* staré řádky schované */
#tournamentViewTime,
#tournamentViewPlace {
  display: none;
}

/* ===== Odpočet ===== */
.tournament-countdown {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.1em;

  font-size: clamp(1.8rem, 5vw, 2.6rem);

  text-shadow: 0 0 28px rgba(120, 255, 220, 0.35);
}

/* ===== Tlačítko účasti ===== */
.tournament-join-btn {
  margin-top: 6px;
  padding: 10px 22px;
  border-radius: 10px;

  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: white;

  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.tournament-join-btn:hover {
  background: rgba(255,255,255,0.2);
  box-shadow: 0 0 18px rgba(120,255,220,0.35);
}

.tournament-join-btn.leave {
  border-color: rgba(255,90,90,0.6);
  background: rgba(255,90,90,0.15);
}


/* ===== Účastníci ===== */
.tournament-participants{
  margin-top: 6px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 10px;

  width: 100%;
  max-width: 92vw;

  padding: 2px 8px;          /* aby se neřezaly horní okraje avatarů */
  min-height: 59px;          /* 55px avatar + 2*2px border */

  overflow-x: auto;          /* jen do stran */
  overflow-y: hidden;        /* zakáže nahoru/dolů uvnitř lišty */
  -webkit-overflow-scrolling: touch;

  touch-action: pan-x;       /* na mobilech povolí jen horizontální gesto v liště */
}


.tournament-participants img {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.4);
  transition: transform 0.2s ease;
}

.tournament-participants img:hover {
  transform: scale(1.1);
}

/* ===== Bublina se jménem ===== */
.participant-wrap{
  position: relative;
  flex: 0 0 auto;
}


.tournament-participants { scrollbar-width: none; }
.tournament-participants::-webkit-scrollbar { display: none; }

.participant-bubble{
  position: fixed;          /* FIX: ať se bublina neřeže uvnitř overflow-x scrollu */
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  margin-top: -10px;

  padding: 6px 10px;
  border-radius: 8px;

  font-size: 0.85rem;
  white-space: nowrap;

  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 10px 25px rgba(0,0,0,0.45);

  pointer-events: none;
  z-index: 9999;
}


/* ===== Mobile úpravy ===== */
@media (max-width: 600px) {
  .tournament-title {
    font-size: clamp(2.8rem, 9vw, 4rem);
  }

  .tournament-countdown {
    font-size: clamp(2rem, 7vw, 3rem);
  }

  .t-meta {
    gap: 8px;
  }

  .t-trophy-image {
    width: 100px;
    height: 100px;
  }
}


/* ===== Navigace turnajů: šipky + pager v jednom řádku ===== */
.t-navrow{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 2px;
}

.t-pager{
  min-width: 62px;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.7;
}

.t-navbtn{
  width: 40px;
  height: 40px;
  border-radius: 999px;

  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.92);

  display: grid;
  place-items: center;

  cursor: pointer;
  font-size: 26px;
  line-height: 1;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
  opacity: 0.9;
}

.t-navbtn:hover{
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 18px rgba(120,255,220,0.22);
  opacity: 1;
}

.t-navbtn:active{
  transform: translateY(1px);
}

.t-navbtn:disabled{
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

.t-empty{
  margin-top: 10px;
  opacity: 0.75;
  font-size: 1rem;
  text-align: center;
}

.tournament-room-btn{
  margin-top: 6px;
  padding: 10px 22px;
  border-radius: 10px;

  border: 1px solid rgba(120,255,220,0.4);
  background: rgba(120,255,220,0.12);
  color: rgba(255,255,255,0.95);

  cursor: pointer;
  font-size: 0.95rem;

  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.tournament-room-btn:hover{
  background: rgba(120,255,220,0.22);
  box-shadow: 0 0 18px rgba(120,255,220,0.35);
}

/* ===== Empty state sprite (4 frames vertical, 3fps) ===== */
.t-empty-sprite-wrap{
  margin: 14px auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  opacity: 0.7;
}

.t-empty-sprite{
  width: 200px;
  height: 200px;

  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 200px 800px;

  animation: tEmptySprite 1.333333s steps(4, end) infinite;
}

/* překrytí druhého spritu */
.t-empty-sprite + .t-empty-sprite{
  margin-left: -60px;
}

/* kdo je nahoře */
.sprite-1{
  background-image: url('sprites/boy_1.png');
  position: relative;
  z-index: 2;
}

.sprite-2{
  background-image: url('sprites/girl_1.png');
  position: relative;
  z-index: 1;
}

@keyframes tEmptySprite{
  from { background-position: 0 0; }
  to   { background-position: 0 -800px; }
}


/* === Sprity u aktivního turnaje (vlevo kluci, vpravo holky) === */
.tournament-date{
  position: relative;
  width: min(1000px, 92vw);
}

.t-meta{
  position: relative;
  z-index: 2;
}

.t-active-sprite-wrap{
  position: absolute;
  inset: 0;
  pointer-events: none;
  height: 400px;
  opacity: 0.7;
  z-index: 1;
}

.t-active-sprite{
  position: absolute;
  top: -10%;
  transform: translateY(-50%);
  width: 400px;
  height: 400px;

  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 400px 1600px; /* 4 × 400px */

  animation: tActiveSprite 1.333333s steps(4, end) infinite; /* ✅ tady byla chyba */
  opacity: 0.85;

  image-rendering: pixelated;
}

@keyframes tActiveSprite{
  from { background-position: 0 0; }
  to   { background-position: 0 -1600px; }
}

.sprite-left{  left: -145px; }
.sprite-right{ right: -120px; }

/* Na mobilech schovat sprity u aktivního turnaje */
@media (max-width: 600px){
  .t-active-sprite-wrap{
    display: none !important;
  }
}
/* ===== Archivované turnaje / statistiky ===== */
.t-archived-wrap{
  width: min(1000px, 92vw);
  margin: 0 auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.t-archived-head{
  display: none !important;
}

.t-archived-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(120,255,220,0.14);
  color: rgba(255,255,255,0.96);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.t-archived-meta{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.t-stats-layout{
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.t-stats-panel{
  position: relative;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  text-align: left;
}

.t-stats-panel-title{
  display: none !important;
}

.t-stats-ranking-list,
.t-stats-team-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.t-stats-ranking-item,
.t-stats-team-item{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8,18,36,0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
}

.t-stats-ranking-item{
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  position: relative;
}

.t-stats-ranking-item::before,
.t-stats-team-item::before{
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--team-color, #78ffd4);
}

.t-stats-ranking-place{
  font-size: 0.95rem;
  opacity: 0.84;
}

.t-stats-ranking-main{
  min-width: 0;
}

.t-stats-ranking-team,
.t-stats-team-name{
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.04em;
}

.t-stats-ranking-team{
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1;
}

.t-stats-ranking-members{
  margin-top: 6px;
  opacity: 0.84;
  line-height: 1.45;
  word-break: break-word;
}

.t-stats-ranking-score,
.t-stats-team-score{
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 700;
}

.t-stats-team-item{
  position: relative;
  padding: 14px 16px 16px;
}

.t-stats-team-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.t-stats-team-name{
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  line-height: 1;
}

.t-stats-team-members{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.t-stats-member-chip{
  display: none !important;
}

.t-stats-member-chip img{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 34px;
}

.t-stats-member-chip span{
  min-width: 0;
  overflow-wrap: anywhere;
}

.t-stats-member-chip--empty{
  opacity: 0.72;
}

.t-stats-empty{
  padding: 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  text-align: center;
  opacity: 0.78;
}

@media (max-width: 780px){
  .t-archived-wrap{
    width: min(100%, 94vw);
  }

  .t-stats-panel{
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .t-stats-ranking-item{
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .t-stats-ranking-score,
  .t-stats-team-score{
    white-space: normal;
  }

  .t-stats-team-top{
    flex-direction: column;
    align-items: flex-start;
  }

  .t-stats-member-chip{
    width: 100%;
    border-radius: 16px;
  }
}

@media (max-width: 480px){
  .t-archived-meta{
    gap: 8px;
  }

  .t-chip{
    max-width: 100%;
  }

  .t-chip span{
    overflow-wrap: anywhere;
  }

  .t-stats-panel-title{
    margin-bottom: 12px;
  }

  .t-stats-ranking-item,
  .t-stats-team-item{
    padding-left: 14px;
    padding-right: 14px;
  }

  .t-stats-member-chip{
    align-items: flex-start;
  }
}


/* ===== Úprava odehraných turnajů ===== */
.t-stats-team-list,
.t-stats-team-item,
.t-stats-member-chip{
  display: none !important;
}



/* ===== Miniturnaj ===== */
.tournament-mini-label {
  margin-bottom: -6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
}

.tournament-mini-label--tournament {
  background: rgba(139, 92, 246, 0.28);
  border-color: rgba(196, 181, 253, 0.55);
}

.tournament-mini-label--palermo {
  background: rgba(234, 179, 8, 0.3);
  border-color: rgba(253, 224, 71, 0.58);
}

.tournament-mini-label--mini {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(252, 165, 165, 0.52);
}

.tournament-mini-label--memory {
  background: rgba(34, 197, 94, 0.28);
  border-color: rgba(134, 239, 172, 0.52);
}

.tournament-mini-label--cards {
  background: rgba(45, 212, 191, 0.32);
  border-color: rgba(153, 246, 228, 0.58);
}

.t-mini-dates {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.t-mini-date-block {
  min-width: min(220px, 90vw);
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.t-mini-date-label {
  margin-bottom: 4px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}

.t-mini-date-value {
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  color: rgba(255,255,255,0.96);
}

.t-mini-leader{
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.t-mini-leader-label{
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}

.t-mini-leader-card{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.t-mini-podium-avatars{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.t-mini-podium-avatar{
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.35);
  box-shadow: 0 0 18px rgba(120,255,220,0.18);
  background: rgba(255,255,255,0.08);
  flex: 0 0 auto;
}

.t-mini-podium-avatar--leader{
  width: 72px;
  height: 72px;
}

.t-mini-podium-avatar--side{
  width: 56px;
  height: 56px;
  opacity: 0.92;
}

.t-mini-podium-avatar--placeholder{
  background: rgba(255,255,255,0.05);
  border-style: dashed;
  box-shadow: none;
}

.t-mini-leader-name{
  font-size: 1rem;
  color: rgba(255,255,255,0.96);
  text-align: center;
}

.tournament-mini-settings-btn,
.tournament-mini-play-btn,
.tournament-mini-pay-btn,
.tournament-mini-challenge-btn {
  min-width: min(320px, 90vw);
}

.tournament-mini-challenge-btn{
  margin-top: 0;
}

.tournament-mini-pay-btn{
  border-color: rgba(255, 215, 120, 0.45);
  background: rgba(255, 200, 60, 0.16);
}

.tournament-mini-pay-btn:hover{
  background: rgba(255, 200, 60, 0.24);
  box-shadow: 0 0 18px rgba(255, 200, 60, 0.28);
}

@media (max-width: 600px){

  .t-mini-podium-avatars {
    gap: 8px;
  }

  .t-mini-podium-avatar--leader {
    width: 64px;
    height: 64px;
  }

  .t-mini-podium-avatar--side {
    width: 48px;
    height: 48px;
  }
  .t-mini-dates {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .t-mini-date-block {
    min-width: 0;
    flex: 1;
  }
}

.tournament-mini-end-btn{
  border-color: rgba(255,120,120,0.45);
  background: rgba(255,90,90,0.14);
}

.tournament-mini-end-btn:hover{
  background: rgba(255,90,90,0.24);
  box-shadow: 0 0 18px rgba(255,90,90,0.28);
}



/* ===== Výzva hráčům ===== */
.challenge-players-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}

.challenge-player-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}

.challenge-player-main{
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.challenge-player-avatar-wrap{
  flex: 0 0 auto;
}

.challenge-player-avatar-wrap img,
.challenge-player-avatar{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
}

.challenge-player-avatar--placeholder{
  display: grid;
  place-items: center;
  font-weight: 700;
  color: rgba(255,255,255,0.82);
}

.challenge-player-text{
  min-width: 0;
  text-align: left;
}

.challenge-player-name,
.challenge-player-lastname{
  overflow-wrap: anywhere;
}

.challenge-player-name{
  font-size: 1rem;
  color: rgba(255,255,255,0.96);
}

.challenge-player-lastname{
  margin-top: 2px;
  font-size: 0.92rem;
  color: rgba(255,255,255,0.72);
}

.challenge-player-invite-btn{
  flex: 0 0 auto;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.96);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.challenge-player-invite-btn:hover{
  background: rgba(255,255,255,0.18);
  box-shadow: 0 0 16px rgba(120,255,220,0.22);
}

.challenge-players-empty{
  padding: 18px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.78);
  text-align: center;
}

@media (max-width: 560px){
  .challenge-player-row{
    align-items: stretch;
    flex-direction: column;
  }

  .challenge-player-invite-btn{
    width: 100%;
  }
}
