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

body {
  background-color: var(--t-bg);
  color: var(--t-ink);
  font-family: var(--t-body);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.header {
  background-color: var(--t-bg-deep);
  padding: 0 16px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-placeholder {
  background-color: var(--t-line);
  color: #888;
  width: 36px;
  height: 36px;
  border-radius: var(--t-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.event-name {
  font-size: 40px;
  font-weight: bold;
  color: var(--t-accent);
}

.clock {
  background-color: var(--t-surface-2);
  color: var(--t-accent);
  font-size: 40px;
  padding: 8px 16px;
  border-radius: var(--t-radius-sm);
}

/* BRACKET LABEL */
.bracket-label {
  padding: 4px 16px;
  font-size: 30px;
  border-left: 5px solid;
}
.groups {
  background-color: #0a1a2a;
  color: #4a9eff;
  border-color: #4a9eff;
}
.match-row.completed {
  opacity: 0.5;
}

.match-row.completed .station-bullet {
  background-color: var(--t-line);
  color: var(--t-muted-2);
}
.bronze {
  background-color: #1a1208;
  color: #cd7f32;
  border-color: #cd7f32;
}

.redemption {
  background-color: #0a1a0a;
  color: #4aaa4a;
  border-color: #4aaa4a;
}

.side {
  background-color: #1a1a1a;
  color: #888888;
  border-color: #888888;
}
.top8 {
  background-color: #1f1a00;
  color: #ffcc00;
  border-color: #ffcc00;
}

/* MATCH ROW */
.match-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex: 1;
  background-color: var(--t-surface);
}

.matches {
  display: flex;
  flex-direction: column;
  flex: 1;
}
/* STATION BULLET */
.station-bullet {
  background-color: var(--t-accent);
  color: var(--t-highlight);
  font-size: 100px;
  font-weight: bold;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* TEAMS */
.team {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  place-items: center;
  min-width: 0;
}

.team-name {
  font-size: 35px;
  font-weight: bold;
}

.players {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 90%;
  font-size: 25px;
  color: var(--t-muted);
  overflow:hidden;
}

.team.right {
  text-align: right;
}


/* SCORES */
.scores {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.score {
  background-color: var(--t-bg-deep);
  color: var(--t-highlight);
  font-size: 38px;
  font-weight: bold;
  width: 64px;
  height: 72px;
  border-radius: var(--t-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-divider {
  color: var(--t-ink);
  font-size: 20px;
}

/* STREAM FOOTER */
.stream-footer {
  background-color: var(--t-bg-deep);
  border-top: 1px solid var(--t-line);
  height: 100px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 25px;
  padding: 0 16px;
  margin-top: auto;
  font-size: 30px;
}

.twitch-badge {
  background-color: #9146ff;
  color: var(--t-ink);
  font-size: 30px;
  font-weight: bold;
  padding: 4px 20px;
  border-radius: var(--t-radius-sm);
}

.twitch-link {
  color: #9146ff;
  font-size: 30px;
}

.on-stream {
  color: var(--t-ink-2);
  font-size: 30px;
}

.event-logo {
  height: 100px;
  width: 100px;
  object-fit: contain;
  border-radius: 50%;
}
.match-row {
  border-bottom: 3px solid var(--t-line);
}
.gengame-logo {
  height: 64px;
  object-fit: contain;
}
/* Added: Silver bracket label (used by the server's phase styles) */
.silver {
  background-color: #1a1a22;
  color: #aaaacc;
  border-color: #aaaacc;
}

/* =========================================================
   PHONE LAYOUT (screens up to 760px wide)
   Each match becomes a compact two-line scoreboard:
     (1)  Team A ........ 2
          Team B ........ 1
   The TV layout above is unchanged.
   ========================================================= */
@media (max-width: 760px) {
  body {
    height: auto;
    min-height: 100vh;
  }

  /* Header */
  .header {
    height: auto;
    padding: 10px 12px;
    gap: 10px;
  }
  .header-left { gap: 10px; min-width: 0; }
  .event-logo { height: 40px; width: 40px; flex-shrink: 0; }
  .event-name { font-size: 17px; line-height: 1.2; }
  .clock { font-size: 16px; padding: 5px 9px; flex-shrink: 0; }

  /* Bracket labels */
  .bracket-label {
    font-size: 15px;
    font-weight: bold;
    padding: 6px 12px;
    border-left-width: 4px;
  }

  /* Match rows: grid instead of a single long row */
  .matches { flex: none; }
  .match-row {
    flex: none;
    display: grid;
    grid-template-columns: 52px 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 6px;
    align-items: center;
    padding: 10px 12px;
    border-bottom-width: 1px;
  }
  .station-bullet {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 52px;
    height: 52px;
    font-size: 26px;
  }
  .team {
    min-width: 0;
    gap: 2px;
    place-items: start;
    align-items: flex-start;
    text-align: left;
  }
  .team.left  { grid-column: 2; grid-row: 1; }
  .team.right { grid-column: 2; grid-row: 2; text-align: left; }
  .team-name {
    font-size: 17px;
    line-height: 1.25;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .players {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 2px 10px;
    font-size: 12px;
  }

  /* Scores stack vertically, lined up with each team */
  .scores {
    grid-column: 3;
    grid-row: 1 / span 2;
    flex-direction: column;
    align-self: stretch;
    justify-content: space-around;
    gap: 6px;
  }
  .score {
    width: 38px;
    height: 34px;
    font-size: 20px;
  }
  .score-divider { display: none; }

  /* Footer */
  .stream-footer {
    height: auto;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    font-size: 14px;
  }
  .gengame-logo { height: 26px; }
  .twitch-badge { font-size: 12px; padding: 2px 8px; }
  .twitch-link, .on-stream { font-size: 14px; }
  .divider { display: none; }
  .on-stream { flex-basis: 100%; line-height: 1.35; }
}


/* Theme: fonts (colors come from /theme.css) */
.event-name, .clock, .bracket-label, .team-name { font-family: var(--t-display); }
.event-name { letter-spacing: .02em; }
.team-name { letter-spacing: .01em; }
.station-bullet { color: var(--t-highlight); }
.station-bullet { color: #ffffff; }


/* Bracket link (footer, right side) */
.bracket-link {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 24px;
  font-weight: bold;
  color: var(--t-muted);
  text-decoration: none;
  border: 1px solid var(--t-line);
  border-radius: var(--t-radius-sm);
  padding: 6px 16px;
  white-space: nowrap;
}
.bracket-link:hover { color: var(--t-ink); border-color: var(--t-accent); }
.bracket-link[hidden] { display: none; }
@media (max-width: 760px) {
  .bracket-link { font-size: 13px; padding: 3px 10px; margin-left: auto; }
}
