:root {
  --bg: #0a1128;
  --bg-card: #111b3a;
  --bg-card-alt: #16234a;
  --border: #24335f;
  --text: #f0f4ff;
  --text-dim: #8b9bc4;
  --accent: #ffc933;
  --green: #2dd4a7;
  --red: #ff5d73;
  --live: #ff3b5c;
}

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

html, body { height: 100%; }

body {
  background: radial-gradient(120% 120% at 50% 0%, #14204a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─── */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 44px 14px;
}
.brand { display: flex; align-items: center; gap: 18px; }
.trophy { font-size: 44px; }
.brand h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#screen-title {
  font-size: 17px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}
.clock { text-align: right; }
#clock-time { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
#clock-date { font-size: 14px; color: var(--text-dim); }

/* ─── Stage ─── */
#stage {
  flex: 1;
  padding: 8px 44px 16px;
  overflow: hidden;
  position: relative;
}
.screen { animation: slidein 0.6s ease; height: 100%; }
@keyframes slidein {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.loading {
  display: flex; height: 100%;
  align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 22px;
}

/* ─── Matches screen ─── */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  justify-content: center;
}
.match-row {
  display: grid;
  grid-template-columns: 1fr 150px 1fr 130px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 26px;
}
.match-row.live { border-color: var(--live); box-shadow: 0 0 18px rgba(255, 59, 92, 0.25); }
.team { display: flex; align-items: center; gap: 14px; font-size: 24px; font-weight: 600; }
.team.home { justify-content: flex-end; text-align: right; }
.crest { width: 38px; height: 38px; object-fit: contain; }
.tla-badge {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-card-alt); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-dim);
}
.match-center { text-align: center; }
.match-score { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.match-time { font-size: 26px; font-weight: 700; color: var(--text-dim); }
.match-meta { text-align: right; font-size: 14px; color: var(--text-dim); }
.badge {
  display: inline-block; padding: 3px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
}
.badge.live { background: var(--live); color: #fff; animation: pulse 1.4s infinite; }
.badge.ft { background: var(--bg-card-alt); color: var(--text-dim); }
.badge.upcoming { background: rgba(255, 201, 51, 0.15); color: var(--accent); }
@keyframes pulse { 50% { opacity: 0.55; } }
.penalty-note { font-size: 14px; color: var(--accent); margin-top: 2px; }

/* ─── Standings screen ─── */
.groups-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  height: 100%;
}
.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
}
.group-card h3 {
  font-size: 17px; font-weight: 800; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px;
}
.group-card table { width: 100%; border-collapse: collapse; flex: 1; table-layout: fixed; }
.group-card col.team-col-w { width: 42%; }
.group-card th {
  font-size: 12px; color: var(--text-dim); text-transform: uppercase;
  text-align: right; padding: 4px 6px; font-weight: 600;
}
.group-card th.team-col { text-align: left; }
.group-card td {
  font-size: 17px; padding: 6px; text-align: right;
  font-variant-numeric: tabular-nums; border-top: 1px solid var(--border);
}
.group-card td.team-col { text-align: left; font-weight: 600; overflow: hidden; }
.team-cell > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-card td.pts { font-weight: 800; color: var(--accent); }
.team-cell { display: flex; align-items: center; gap: 10px; }
.team-cell .crest, .team-cell .tla-badge { width: 26px; height: 26px; font-size: 10px; }
.pos-q { color: var(--green); font-weight: 700; }

/* ─── Bracket screen ─── */
.bracket {
  display: grid;
  grid-auto-flow: column;
  gap: 16px;
  height: 100%;
  align-items: stretch;
}
.bracket-round { display: flex; flex-direction: column; min-width: 0; }
.bracket-round h4 {
  text-align: center; font-size: 13px; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
}
.bracket-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 6px; }
.bracket-match {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
}
.bracket-match.live { border-color: var(--live); }
.bracket-team {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 2px 0; font-weight: 600; white-space: nowrap; overflow: hidden;
}
.bracket-team .name { overflow: hidden; text-overflow: ellipsis; }
.bracket-team.winner { color: var(--green); }
.bracket-team.tbd { color: var(--text-dim); font-weight: 400; }
.bracket-empty {
  display: flex; height: 100%; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px; color: var(--text-dim); font-size: 22px;
}
.bracket-empty .big { font-size: 56px; }

/* ─── Video screen ─── */
.video-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-wrap iframe {
  height: 100%;
  aspect-ratio: 9 / 16;
  max-width: 100%;
  border-radius: 14px;
  background: #000;
}

/* ─── Footer ─── */
#footer {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 44px 18px;
}
#dots { display: flex; gap: 8px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border); transition: background 0.3s;
}
.dot.active { background: var(--accent); }
#progress {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--border); overflow: hidden;
}
#progress-bar {
  height: 100%; width: 0%;
  background: var(--accent); border-radius: 2px;
}
#progress-bar.animate { transition: width linear; }
#source-note { font-size: 12px; color: var(--text-dim); }

/* ─── Portrait / narrow signage (örn. dikey 768×1024 monitör) ─── */
@media (max-width: 820px) {
  #header { padding: 16px 20px 10px; }
  .trophy { font-size: 34px; }
  .brand h1 { font-size: 20px; }
  #screen-title { font-size: 14px; }
  #clock-time { font-size: 26px; }
  #clock-date { font-size: 12px; }

  #stage { padding: 6px 20px 10px; }
  #footer { padding: 8px 20px 14px; gap: 14px; }

  /* Maç satırları: dar gridde sıkılaştır */
  .match-row {
    grid-template-columns: 1fr 96px 1fr 86px;
    padding: 10px 14px;
    border-radius: 11px;
  }
  .team { font-size: 17px; gap: 8px; }
  .crest, .tla-badge { width: 28px; height: 28px; }
  .tla-badge { font-size: 10px; }
  .match-score { font-size: 24px; }
  .match-time { font-size: 19px; }
  .match-meta { font-size: 11px; }
  .badge { padding: 2px 8px; font-size: 10px; }
  .match-list { gap: 9px; }

  /* Puan tabloları: 2 sütun korunur, kart içi küçülür */
  .groups-grid { gap: 12px; }
  .group-card { padding: 12px 14px; border-radius: 11px; }
  .group-card h3 { font-size: 14px; margin-bottom: 6px; }
  .group-card th { font-size: 10px; padding: 3px 4px; }
  .group-card td { font-size: 13px; padding: 4px; }
  .team-cell { gap: 6px; }
  .team-cell .crest, .team-cell .tla-badge { width: 20px; height: 20px; font-size: 8px; }

  /* Eleme ağacı: 6 sütun dar alanda */
  .bracket { gap: 8px; }
  .bracket-round h4 { font-size: 10px; margin-bottom: 5px; }
  .bracket-match { padding: 3px 6px; border-radius: 6px; font-size: 11px; }
  .bracket-matches { gap: 4px; }
}
