/* ============================================================
   display.css — Projektor / živý turnajový display
   Standalone stránka, bez hlavní navigace webu
   ============================================================ */

/* ─── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0a0c10;
  --bg-card:     #13171f;
  --bg-card-alt: #1a2030;
  --border:      #2a3040;
  --accent:      #f59e0b;
  --accent-dim:  #92400e;
  --green:       #22c55e;
  --green-dim:   #14532d;
  --red:         #ef4444;
  --blue:        #3b82f6;
  --text:        #f0f4f8;
  --text-muted:  #8b949e;
  --text-dim:    #3d4451;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 4px 32px rgba(0,0,0,0.6);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ─── Hlavička ──────────────────────────────────────────────── */
.disp-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #0d1117 0%, #1a2236 100%);
  border-bottom: 3px solid var(--accent);
  flex-shrink: 0;
}

.disp-logo {
  font-size: 2rem;
  flex-shrink: 0;
}

.disp-title {
  flex: 1;
}

.disp-title h1 {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.disp-venue {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.disp-round-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.disp-round-label {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* Čas kola */
.disp-round-elapsed {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 3px 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* LIVE badge */
.disp-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 20px;
}

.disp-live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.disp-finished-badge {
  background: rgba(100,100,100,0.15);
  border: 1px solid #555;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  border-radius: 20px;
}

/* ─── Hlavní oblast ─────────────────────────────────────────── */
.disp-main {
  flex: 1;
  padding: 16px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  min-height: 0;
}

/* ─── Split layout: zápasy vlevo, pořadí vpravo ─────────────── */
.disp-split {
  display: flex;
  flex: 1;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.disp-matches-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.disp-matches-col .disp-match-grid {
  flex: 1;
  align-content: start;
  overflow-y: auto;
}

/* ─── Pravý sloupec: Pořadí ─────────────────────────────────── */
.disp-standings-col {
  flex: 0 0 290px;
  width: 290px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.disp-standings-col-header {
  padding: 12px 16px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.disp-standings-col .disp-standings-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  max-width: none;
}

.disp-standings-col .disp-standings-row {
  background: transparent;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 9px 14px;
  font-size: 0.92rem;
}

.disp-standings-col .disp-standings-row:last-child {
  border-bottom: none;
}

.disp-standings-col .disp-standings-rank {
  font-size: 0.85rem;
}

.disp-standings-col .disp-standings-name {
  font-size: 0.95rem;
}

.disp-standings-col .disp-standings-record {
  font-size: 0.75rem;
}

/* ─── Section title (KOLO 1 apod.) ─────────────────────────── */
.disp-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.disp-section-title.sm { font-size: 0.68rem; }

.disp-phase-tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.disp-phase-tag.ko {
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.4);
  color: var(--accent);
}

/* ─── Čekání / prázdný stav ─────────────────────────────────── */
.disp-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex: 1;
}

.disp-waiting-icon { font-size: 5rem; opacity: 0.4; }
.disp-waiting-text { font-size: 2.2rem; font-weight: 800; color: var(--text-muted); }
.disp-waiting-sub  { font-size: 1.1rem; color: var(--text-dim); }

/* ─── Mřížka zápasů ─────────────────────────────────────────── */
.disp-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  flex: 1;
  min-height: 0;
  align-content: stretch;
  align-items: stretch;
}

/* ─── Match card ────────────────────────────────────────────── */
.disp-match-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s, border-color 0.3s;
}

/* PENDING */
.disp-match-card.status-pending {
  opacity: 0.65;
}

/* RUNNING — svítí */
.disp-match-card.status-running {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 8px 40px rgba(245,158,11,0.3);
}

/* FINISHED — ztmaven */
.disp-match-card.status-finished {
  background: #0e1014;
  border-color: #1e2228;
  opacity: 0.8;
}

/* Time UP — cervena */
.disp-match-card.time-up {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px var(--red), 0 8px 40px rgba(239,68,68,0.35) !important;
  animation: flash-red 0.8s ease-in-out infinite;
}

@keyframes flash-red {
  0%, 100% { box-shadow: 0 0 0 2px var(--red), 0 4px 24px rgba(239,68,68,0.3); }
  50%       { box-shadow: 0 0 0 3px var(--red), 0 4px 40px rgba(239,68,68,0.55); }
}

.disp-table-label {
  background: var(--bg-card-alt);
  border-bottom: 2px solid var(--border);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 20px;
  text-align: center;
}

.status-running .disp-table-label {
  background: rgba(245,158,11,0.12);
  border-bottom-color: rgba(245,158,11,0.4);
  color: var(--accent);
}

.disp-table-waiting {
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.disp-match-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
}

.disp-player {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  font-weight: 800;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  letter-spacing: -0.01em;
  min-height: 0;
}

.disp-player.winner {
  color: var(--green);
  text-shadow: 0 0 24px rgba(34,197,94,0.4);
}

.disp-player.loser {
  color: var(--text-muted);
  font-weight: 600;
}

.disp-score-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(0,0,0,0.35);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}

.status-running .disp-score-block {
  border-top-color: rgba(245,158,11,0.25);
  border-bottom-color: rgba(245,158,11,0.25);
}

/* Skóre */
.disp-score {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  font-weight: 900;
  color: var(--text-muted);
  line-height: 1;
  min-width: 1.5ch;
  text-align: center;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.disp-score.winner {
  color: var(--green);
  text-shadow: 0 0 20px rgba(34,197,94,0.5);
}

.disp-colon {
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: 700;
  color: var(--text-dim);
  padding: 0 6px;
}

/* VS (čekání) */
.disp-vs {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 0;
}

/* Running bez timeru */
.disp-vs-live {
  font-size: 2rem;
  color: var(--accent);
  animation: blink-play 1s step-end infinite;
}

@keyframes blink-play {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ─── Timer ─────────────────────────────────────────────────── */
.disp-timer {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1;
  min-width: 4.5ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.disp-timer.timer-warning {
  color: var(--red);
  animation: pulse-timer 0.5s ease-in-out infinite;
}

.disp-timer.timer-expired {
  color: var(--red);
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  letter-spacing: 0.05em;
}

@keyframes pulse-timer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Pódium (ukončený turnaj) ──────────────────────────────── */
.disp-finished-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.disp-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.disp-podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 32px;
  min-width: 180px;
}

.disp-podium-1 {
  border-color: #fbbf24;
  box-shadow: 0 0 40px rgba(251,191,36,0.3);
  order: 2;
  transform: translateY(-14px);
}

.disp-podium-2 { order: 1; }
.disp-podium-3 { order: 3; }

.disp-podium-medal { font-size: 2.8rem; }
.disp-podium-name  { font-size: 1.5rem; font-weight: 800; text-align: center; }
.disp-podium-pts   { font-size: 1rem; color: var(--text-muted); font-weight: 600; }

/* ─── Pořadí ────────────────────────────────────────────────── */
/* Legacy: ukončený turnaj (finished standings list pod pódiem) */
.disp-standings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 560px;
}

.disp-standings-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.disp-standings-row.advance {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.05);
}

.disp-standings-rank {
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  font-size: 0.8rem;
}

.disp-standings-rank.top {
  color: var(--accent);
}

.disp-standings-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.disp-standings-pts {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.88rem;
  white-space: nowrap;
}

.disp-standings-record {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── Skupiny (group_ko) ────────────────────────────────────── */
.disp-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.disp-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.disp-group-label {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
  padding: 7px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.disp-group .disp-standings-row {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  grid-template-columns: 26px 1fr auto;
  font-size: 0.85rem;
  padding: 6px 12px;
}

.disp-group .disp-standings-row:last-child {
  border-bottom: none;
}

.disp-group .disp-standings-row.advance {
  background: rgba(34,197,94,0.08);
}

/* ─── Patička — scrollovací ticker ──────────────────────────── */
.disp-footer {
  display: flex;
  align-items: stretch;
  height: 38px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
  overflow: hidden;
}

.disp-footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.disp-footer-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.disp-footer-ticker-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  position: relative;
}

.disp-footer-ticker {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--text-muted);
  /* animace nastavena JS */
}

.disp-fticker-item {
  padding: 0 20px;
  letter-spacing: 0.01em;
}

.disp-fticker-sep {
  color: var(--accent);
  opacity: 0.5;
  font-size: 0.55rem;
  flex-shrink: 0;
}

@keyframes footer-ticker-scroll {
  from { transform: translateX(100vw); }
  to   { transform: translateX(-100%); }
}

/* ─── Responzivita (menší projektory / tablety) ──────────────── */
@media (max-width: 900px) {
  .disp-split {
    flex-direction: column;
  }
  .disp-standings-col {
    flex: 0 0 auto;
    width: 100%;
    max-height: 200px;
  }
  .disp-standings-col .disp-standings-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px;
    gap: 4px;
  }
  .disp-standings-col .disp-standings-row {
    flex-shrink: 0;
    border-bottom: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card-alt);
    grid-template-columns: 22px 1fr auto;
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  .disp-standings-col .disp-standings-record { display: none; }
}

@media (max-width: 720px) {
  .disp-header { padding: 10px 16px; gap: 10px; }
  .disp-main   { padding: 12px 12px 8px; }
  .disp-match-grid { grid-template-columns: 1fr; }
  .disp-groups-grid { grid-template-columns: repeat(2, 1fr); }
  .disp-podium { flex-direction: column; align-items: center; }
  .disp-podium-item { min-width: unset; width: 100%; max-width: 260px; }
  .disp-podium-1 { transform: none; order: unset; }
  .disp-podium-2, .disp-podium-3 { order: unset; }
}

/* ─── Ticker oznámení pořadatele ────────────────────────────── */
.disp-ticker-msg {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: #15803d;
  border-top: 3px solid #4ade80;
  padding: 0 20px;
  height: 60px;
  align-items: center;
  gap: 16px;
  overflow: hidden;
}
.disp-ticker-msg--visible {
  display: flex;
}
.disp-ticker-msg-icon {
  font-size: 1.7em;
  flex-shrink: 0;
  animation: disp-pulse 1.5s ease-in-out infinite;
}
.disp-ticker-msg-scroll-wrap {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
}
.disp-ticker-msg-inner {
  white-space: nowrap;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  animation: disp-ticker-scroll 18s linear infinite;
}
@keyframes disp-ticker-scroll {
  0%   { transform: translateX(60vw); }
  100% { transform: translateX(-100%); }
}
@keyframes disp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .7; transform: scale(1.15); }
}
/* Zelená lišta oznámení — posouvá obsah nahoru, footer zůstává dole */
body:has(.disp-ticker-msg--visible) .disp-main {
  padding-bottom: 0;
}
/* Footer vždy dole — ticker msg je fixed nad ním */
