/* Theme */
:root {
  --purple: #280544;
  --black: #121212;
  --orange: #ff8c00;
  --white: #f1f1f1;
  --gray: #2a2a2a;
  --green: #32b736;
}

/* Base */
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--black);
  color: var(--white);
  padding-top: 60px;
  text-align: center;
}

/*a:visited { color: var(--white); } */
a:visited:hover { color: var(--orange); }

img {
  display: block;
  max-width: 100%;
  transition: transform 0.3s ease;
}
img:hover { transform: scale(1.05); }

/* Headings */
h1, h2, h3 {
  color: var(--orange);
  margin-top: 0;
  text-align: center;
}

/* Navigation */
nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  position: fixed;
  top: 0; left: 0; width: 100%;
  background-color: var(--purple);
  padding: 10px 20px;
  z-index: 1000;
}
nav img { height: 40px; width: auto; }
nav a, .nav-link { color: var(--white); text-decoration: none; font-weight: 500; }
nav a:hover, .nav-link:hover { color: var(--orange); }

.nav-dropdown { position: relative; }
.nav-link { cursor: pointer; user-select: none; }
.nav-dropdown-content {
  display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  background: #111; padding: 8px 0; min-width: 160px; z-index: 1000; border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
.nav-dropdown-content a {
  display: block; padding: 8px 16px; text-decoration: none; color: var(--white); white-space: nowrap;
}
.nav-dropdown-content a:hover { background: #222; color: var(--orange); }
.nav-dropdown:hover .nav-dropdown-content { display: block; }

/* Container */
.container {
  max-width: 1000px;
  margin: 2em auto;
  background-color: var(--gray);
  padding: 2em;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.2);
  animation: fadeIn 0.5s ease-in;
  text-align: center;
}

/* Lists (generic) */
ul {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  display: inline-block;
  text-align: left;
  min-width: 600px;
}

li {
  padding: 0.5em 0;
  border-bottom: 1px solid var(--purple);
  color: var(--white);
  transition: background 0.3s, color 0.3s;
}
li:hover {
  background-color: var(--purple);
  color: var(--white);
}

ul li a {
  color: var(--white);
  text-decoration: none;
  display: inline-block;
  width: 100%;
  text-align: left;
  padding: 0.2em 0;
}
ul li a:hover { color: var(--orange); }

/* Large images */
.img-large {
  margin: 1em auto;
  display: block;
  max-width: 100%;
  transition: transform 0.3s ease;
}

/* Section animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Player/Team generic rows */
.player-item, .team-item, .match-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 10px;
  width: 100%;
  justify-content: left;
  padding: 8px 12px;
  box-sizing: border-box;
}

.player-link, .team-link, .match-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: white;
  width: 100%;
}

.player-avatar, .team-avatar {
  width: 40px;
  height: 40px;
  object-fit: scale-down;
  border-radius: 8px;
  margin-right: 12px;
}

.player-name, .team-name { font-size: 1.1em; }

/* Achievements */
.achievement-list {
  margin-top: 2em;
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: center;
}
.achievement-item {
  display: flex;
  align-items: center;
  gap: 1em;
  background-color: var(--gray);
  padding: 0.8em 1em;
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(255, 140, 0, 0.2);
  max-width: 600px;
  width: 100%;
}
.achievement-icon {
  width: 40px; height: 40px; object-fit: cover; border-radius: 5px;
  box-shadow: 0 0 5px rgba(255, 140, 0, 0.3);
}
.achievement-text { color: var(--white); font-size: 1rem; }

/* Game header (teams/teams detail) */
.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  text-align: left;
}
.game-logo { height: 64px; width: auto; object-fit: contain; display: block; }
.game-title { font-size: 1.75rem; font-weight: 700; line-height: 1.1; margin: 0; }

/* Match lists: single neat line per row, then expandable content */
.match-list { list-style: none; margin: 0; padding: 0; }
.match-item {
  padding: 10px 12px;
  border-bottom: 1px solid #333;
  margin-bottom: 0; /* rows are compact, separator handles spacing */
}

/* Grid: Event | Team1 | Center (vs or series) | Team2 | Meta (date) */
.match-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto; /* add leading column for event logo */
  align-items: center;
  gap: 10px 16px;
}

/* Event logo cell */
.event-cell {
  justify-self: start;
}
.event-logo {
  height: 22px;
  width: 22px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  opacity: 0.95;
}

/* Teams inline */
.team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.team--left  { 
  justify-content: flex-start;    /* align content to the left within the left team block */
  flex-direction: row;            /* show logo first, then name */
}.team--right { 
  justify-content: flex-start;    /* pull content toward center */
  flex-direction: row;            /* default order: logo then name */
}

.team-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
}
.team--left .team-name  { text-align: right; }
.team--right .team-name { text-align: left; }

/* Make avatar placement consistent when names are anchored toward center */
.team .team-avatar { margin: 0; }/* Center cell: either "vs" or an inline series score */
.center-cell { text-align: center; min-width: 44px; }
.vs-text { font-weight: 700; color: #bbb; }

/* Inline series score shown in center when winner exists */
.series-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.series-num { min-width: 1ch; text-align: right; color: rgb(165, 0, 0);}
.series-sep { opacity: 0.7; padding: 0 2px; }

/* Meta (right): date, tiny logo if used elsewhere) */
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  white-space: nowrap;
}
.match-date { color: #ccc; font-size: 0.95rem; }

/* Winner color */
.winner { color: var(--green); }

/* Expandable: extra content spans full width, visually centered under middle without affecting columns */
.match-collapsible {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.match-collapsible .match-extra {
  grid-column: 1 / -1;          /* span all columns so no single track widens */
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto; /* mirror main grid to align with center */
  align-items: start;
}

/* Wrapper that occupies the center grid track to visually center content under the series */
.match-collapsible .match-extra .center-spacer {
  grid-column: 2 / 3;           /* align with the middle (series) column */
  justify-self: center;
  text-align: center;
  width: max-content;           /* shrink-to-fit to avoid pushing tracks */
  margin: 0 auto;
}

/* Hidden by default: expanded details */
.expanded-only { 
  display: none; 
  margin: 6px 0 0; 
  padding-left: 0; 
}

/* Expanded state shows details */
.match-collapsible.expanded .expanded-only { display: block; }

/* Per-round scores list (expanded) */
.round-scores {
  list-style: none;
  padding: 0;
  margin: 0;                    /* container is centered by .center-spacer */
  display: grid;
  grid-auto-rows: auto;
  gap: 6px;
  justify-items: center;
}/* Each round score line */
.round-score {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;      /* center the inline-flex row */
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

/* Scores keep their right alignment for clean columns */
.score { 
  min-width: 1.5ch; 
  text-align: right; 
}

/* Under-series info (expanded): game logo + name under the score */
.series-under {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  opacity: 0.9;
  color: #ddd;
}
.game-logo--tiny { height: 18px; width: 18px; object-fit: contain; }

/* Optional caret indicator for expandables */
.match-collapsible::after {
  content: '▾';
  position: absolute;
  right: 8px;
  top: 10px;
  color: #888;
  transition: transform 0.15s ease;
}
.match-collapsible.expanded::after { transform: rotate(180deg); }