:root {
  /* HUD STYLES */
  --corner-size: 16px;
  --line-thickness: 3px;
  --corner-gap: 0px;

  /* COLORS */
  --main-red: #d72638;
  --main-red-0_3: rgba(215, 38, 56, 0.3);
  --text-color: #ffffff;
}

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

html {
  font-size: 62.5%; /* 1rem = 10px */
}

body {
  line-height: 1;
}

/* MAIN SITE BUG, TMP FIX */
body::before {
  z-index: -999;
}

/* STATISTICS SECTION STARTS */
.statistics-section {
  display: block;
  margin: 0 4rem;
  padding: 16rem 0 8rem;
}

.hud-style-title {
  text-align: center;
  margin-bottom: 8rem;
  color: var(--text-color);
}

.hud-style-title h1 {
  font-size: 3.6rem;
  display: inline-block;
  position: relative;

  position: relative;
  display: inline-block;
  padding: 1.2rem 1.8rem;
  color: var(--text-color);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.hud-style-title h1::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;

  background:
    /* top-left horizontal */ linear-gradient(
        to right,
        var(--main-red),
        var(--main-red)
      )
      left var(--corner-gap) top var(--corner-gap) / var(--corner-size)
      var(--line-thickness) no-repeat,
    /* top-left vertical */
      linear-gradient(to bottom, var(--main-red), var(--main-red)) left
      var(--corner-gap) top var(--corner-gap) / var(--line-thickness)
      var(--corner-size) no-repeat,
    /* top-right horizontal */
      linear-gradient(to left, var(--main-red), var(--main-red)) right
      var(--corner-gap) top var(--corner-gap) / var(--corner-size)
      var(--line-thickness) no-repeat,
    /* top-right vertical */
      linear-gradient(to bottom, var(--main-red), var(--main-red)) right
      var(--corner-gap) top var(--corner-gap) / var(--line-thickness)
      var(--corner-size) no-repeat,
    /* bottom-left horizontal */
      linear-gradient(to right, var(--main-red), var(--main-red)) left
      var(--corner-gap) bottom var(--corner-gap) / var(--corner-size)
      var(--line-thickness) no-repeat,
    /* bottom-left vertical */
      linear-gradient(to top, var(--main-red), var(--main-red)) left
      var(--corner-gap) bottom var(--corner-gap) / var(--line-thickness)
      var(--corner-size) no-repeat,
    /* bottom-right horizontal */
      linear-gradient(to left, var(--main-red), var(--main-red)) right
      var(--corner-gap) bottom var(--corner-gap) / var(--corner-size)
      var(--line-thickness) no-repeat,
    /* bottom-right vertical */
      linear-gradient(to top, var(--main-red), var(--main-red)) right
      var(--corner-gap) bottom var(--corner-gap) / var(--line-thickness)
      var(--corner-size) no-repeat;
}

.statistic-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;

  font-family: "IBM Plex Mono", monospace;
}

.statistic-card {
  border: 1px solid var(--main-red-0_3);
  padding: 1.6rem;

  transition: border 0.3s ease, box-shadow 0.3s ease;
}

.statistic-card:hover {
  border: 1px solid var(--text-color);
  box-shadow: 0 0 12px var(--main-red-0_3);
}

.event-details {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.8rem;

  font-size: 1.6rem;
  font-weight: 500;
}

.event-title {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--main-red);

  transition: text-shadow 0.1s ease, color 0.1s ease;
}

.event-title:hover {
  text-shadow: 0 0 8px var(--main-red), 0 0 16px var(--main-red),
    0 0 24px var(--main-red);
  color: var(--text-color);
}

.event-data {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.6rem;

  margin-bottom: 1.2rem;
}

.ctf-point,
.ctf-rating {
  padding: 0.8rem 0.8rem 0.8rem 0;
}

.ctf-point--label,
.ctf-rating--label,
.participants-label {
  text-transform: uppercase;
  font-weight: 400;
  font-size: 1.2rem;
  margin-bottom: 0.8rem;

  opacity: 0.8;
}

.ctf-point-data,
.ctf-rating-data {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--main-red);
}

.participants-names {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.participant-name {
  font-size: 1.2rem;
  padding: 0.5rem 1rem;

  border: 1px solid var(--main-red-0_3);
  transition: border 0.1s ease;
}

.participant-name:hover {
  border: 1px solid var(--main-red);
}

/* SHOW MORE */
.show-more-container {
  display: flex;
  justify-content: center;
  margin: 4rem 0 12rem;
}

.show-more-btn {
  border: 1px solid var(--main-red);
  display: flex;
  justify-content: center;

  font-family: "IBM Plex Mono", monospace;
  padding: 1.2rem 2.4rem;
  font-size: 1.6rem;
  font-weight: 500;

  color: var(--text-color);
  background-color: rgba(0, 0, 0);

  cursor: pointer;
  transition: box-shadow 0.1s ease, transform 0.1s ease;
}

.show-more-btn:hover {
  box-shadow: 0 0 12px var(--main-red-0_3);
}

.show-more-btn:active {
  transform: scale(0.98);
}

.show-more-btn svg {
  width: 1.6rem;
  margin-left: 1rem;

  fill: var(--text-color);
  transition: transform 0.1s ease;
}

.show-more-btn.collapse-btn:hover svg {
  transition: transform 0.1s ease;
}

.show-more-btn:hover svg {
  transform: translateY(2px);
}

.show-more-btn.collapse-btn:hover svg {
  transform: translateY(-2px);
}

/* DATA POINT SECTION */

.performance-stats {
  margin-bottom: 4rem;
}
.data-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.data-box div {
  background: rgba(0, 0, 0, 0.8);

  border: 1px solid var(--main-red-0_3);
  padding: 1.2rem;

  transition: border 0.2s ease;
}

.data-box .events-participated {
  border-bottom: none;
}

.data-box div span:last-child {
  transition: color 0.1s, text-shadow 0.1s;
}

.data-box div:hover span:last-child {
  color: var(--text-color);
  text-shadow: 0 0 8px var(--main-red), 0 0 16px var(--main-red),
    0 0 24px var(--main-red);

  transition: border 0.2s ease;
}

.data-box .country-ranking {
  border-left: none;
  border-right: none;
}
/* BOX HOVER */
/* FIRST BOX */
.data-box .events-participated:hover {
  border: 1px solid var(--text-color);
  border-bottom: none;
}

.data-box .events-participated:hover ~ div {
  border-top: 1px solid var(--text-color);
}

/* SECOND BOX */
.ctftime-rating:hover {
  border: 1px solid var(--text-color);
}

/* THIRD BOX */
.data-box .country-ranking:hover {
  border: 1px solid var(--text-color);
  border-right: none;
  border-left: none;
}

.data-box:has(.country-ranking:hover) .ctftime-rating {
  border-right: 1px solid var(--text-color);
}
.data-box .country-ranking:hover ~ .world-ranking {
  border-left: 1px solid var(--text-color);
}

/* FOURTH BOX */
.data-box .world-ranking:hover {
  border: 1px solid var(--text-color);
}

/* DATA BOX ENDS */
.events-participated {
  grid-column: 1/-1;
}

.data-box div span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 2.4rem;
  font-weight: 600;

  color: var(--main-red);
}

.data-box div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.data-box div span:not(:last-child) {
  text-transform: uppercase;

  color: var(--text-color);
  font-size: 1.2rem;
  opacity: 0.8;
}

/* Data graphs layout and sizing */
.data-stats-graphs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.6rem;
  margin-top: 2rem;
}

.graph-title {
  font-family: "IBM Plex Mono", monospace;
  display: inline-block;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--text-color);
  border: 1px solid var(--main-red-0_3);
  border-top: none;

  padding: 1.2rem;
  transition: border-color 0.1s;
}

.data-stats-graphs .graph-01,
.data-stats-graphs .graph-02,
.team-graph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3.2rem;
  border: 1px solid var(--main-red-0_3);
  /* padding: 0 1.2rem 1.2rem 1.2rem; */
  background: rgba(0, 0, 0, 0.8);

  transition: border-color 0.1s, box-shadow 0.1s;
}

.data-stats-graphs .graph-01:hover,
.data-stats-graphs .graph-02:hover,
.team-graph:hover {
  border: 1px solid var(--text-color);
  box-shadow: 0 0 12px var(--main-red-0_3);
}

.data-stats-graphs .graph-01:hover .graph-title,
.data-stats-graphs .graph-02:hover .graph-title,
.team-graph:hover .graph-title {
  border-color: var(--text-color);
}

/* TEAM DATA SECTION */

.member-data {
  display: grid;
  align-items: start;
  gap: 1.6rem;
  grid-template-columns: repeat(2, 1fr);

  margin-top: 1.6rem;
}

.chart-container {
  padding: 0 5rem;
}

.team-graph .chart-container {
  padding: 0 16rem;
}

/* MEMBER DETAILS */

.members-details {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.8);
  height: 100%;
  border: 1px solid var(--main-red-0_3);
  transition: border 0.2s, box-shadow 0.2s;
  overflow: hidden; /* Important: keeps the scrollbar inside the box */
}

/* .members-details > div {
  padding: 1.6rem;
} */

.members-details:hover {
  border: 1px solid var(--text-color);
  box-shadow: 0 0 12px var(--main-red-0_3);
}

.member-count {
  border-right: 1px solid var(--main-red-0_3);
}

.member-count span {
  font-size: 1.6rem;
  font-weight: 600;

  color: var(--text-color);
}

.member-count span:last-child {
  font-weight: 700;

  color: var(--main-red);
}

.member-join {
  font-family: "IBM Plex Mono", monospace;
}

.member-label {
  font-size: 1.2rem;
  font-weight: 600;

  color: var(--text-color);
}

.member-join a {
  color: var(--main-red);
}

.member-motto {
  grid-column: 1/-1;

  border-top: 1px solid var(--main-red-0_3);

  font-family: "IBM Plex Mono", monospace;
  font-size: 1.2rem;
  font-style: italic;
  text-align: center;
  color: var(--text-color);
  opacity: 0.7;

  line-height: 1.4;
}

/* SECTION FIX */

/* STATISTICS SECTION ENDS */

/* ========== Toast Base ========== */
.toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 9999;

  display: flex;
  align-items: center;
  gap: 1.2rem;

  max-width: 360px;
  padding: 1.2rem 2.4rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 1.6rem;

  background-color: #080808;
  border: 1px solid #ff0033;

  color: var(--text-color);

  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;

  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-icon {
  flex-shrink: 0;
  width: 4.8rem;
  height: 4.8rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 700;
  font-size: 3.2rem;

  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.toast-message {
  font-size: 1.2rem;
  color: #d1d5db;
}

.toast-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 0.3rem;
}

.toast-close:hover {
  color: #e5e7eb;
}

/* RESPONSIVE */
/* 550px */
@media (max-width: 31.25em) {
  .statistics-section {
    padding: 12rem 0 6rem;

    margin: 0 2rem;
  }

  .hud-style-title {
    margin-bottom: 6rem;
  }

  .hud-style-title h1 {
    font-size: 2.6rem;
  }

  .statistic-cards-container {
    display: grid;
    grid-template-columns: 1fr;
  }

  .data-box div span {
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--main-red);
  }

  .data-box div span:not(:last-child) {
    text-transform: uppercase;
    color: var(--text-color);
    font-size: 1.2rem;
    letter-spacing: 0.2px;
    opacity: 0.8;
  }

  .data-box div span:last-child {
    color: var(--text-color);
    text-shadow: 0 0 8px var(--main-red), 0 0 16px var(--main-red),
      0 0 24px var(--main-red);
  }

  .graph-title {
    font-size: 1.4rem;
  }

  .data-stats-graphs {
    grid-template-columns: 1fr;
  }

  .member-data {
    grid-template-columns: 1fr;
  }

  .member-count span {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
  }

  .member-label {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
  }

  .chart-container {
    padding: 0;
  }

  .team-graph .chart-container {
    padding: 0;
  }
  #radarChart {
    padding: 1rem;
  }
}

/* TOP PLACEMENTS SECTION */
/* TOP PLACEMENTS SECTION */
.top-placements {
  grid-column: 1 / -1;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--main-red-0_3);
  padding: 2rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;

  /* Fix for scrollable expansion (robust grid constraint) */
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.top-placements:hover {
  border: 1px solid var(--text-color);
  box-shadow: 0 0 12px var(--main-red-0_3);
}

.top-placements-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.top-placements-header,
.placements-headers {
  padding: 1.6rem;
  flex-shrink: 0; /* Prevents headers from being squashed */
}

/* Reusing graph-title style but removing border/margin to fit header */
.top-placements-header .graph-title {
  margin: 0;
  border: none;
  padding: 0;
  background: none;
  font-size: 2rem;
  text-align: left;
}

.show-all-btn {
  background: transparent;
  border: 1px solid var(--main-red);
  color: var(--text-color);
  padding: 0.6rem 1.6rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.show-all-btn:hover {
  background: var(--main-red);
  box-shadow: 0 0 10px var(--main-red-0_3);
}

.placements-headers {
  display: grid;
  grid-template-columns: 0.6fr 1.2fr 3fr; /* Rank | Date | Contest */
  padding: 1rem 1.6rem;
  background: rgba(215, 38, 56, 0.15); /* Distinct header bg */

  font-family: "IBM Plex Mono", monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--main-red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.placements-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
  max-height: 100%;
  overflow-y: hidden;
  flex-grow: 1;
}

/* Stretched Mode (Default Top 5) */
.placements-list.stretched .placement-item {
  flex-grow: 1; /* Stretch to fill space */
}

/* Scrollable Mode (Expanded) */
.placements-list.scrollable {
  flex-grow: 1; /* This is the core of your formula */
  overflow-y: auto; /* Enable scrolling */
  min-height: 0; /* Critical for flex-grow scrolling */
  max-height: none; /* Remove any old fixed limits */
  padding: 0 1.6rem 1.6rem; /* Padding only for the list content */
}

.placements-list.scrollable .placement-item {
  flex-grow: 0; /* Keep standard size */
  /* min-height: 48px; Ensure clickability */
}

/* Scrollbar styling */
.placements-list::-webkit-scrollbar {
  width: 6px;
}
.placements-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}
.placements-list::-webkit-scrollbar-thumb {
  background: var(--main-red);
  border-radius: 3px;
}

.placement-item {
  display: grid;
  grid-template-columns: 0.6fr 1.2fr 3fr; /* Matches headers */
  align-items: center;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.4rem;
  color: var(--text-color);
  transition: background 0.2s ease;
}

.placement-item:last-child {
  border-bottom: none;
}

.placement-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.placement-rank {
  font-weight: 700;
  color: var(--main-red); /* Highlight rank */
}

.placement-date {
  font-size: 1.2rem;
  opacity: 0.7;
}

.placement-contest {
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Adjustments */
@media (max-width: 550px) {
  .placements-headers,
  .placement-item {
    grid-template-columns: 0.5fr 1fr 2fr;
    font-size: 1.2rem;
    padding: 1rem;
  }
}

/* Adjust Team Graph to handle added stats */
.team-graph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0rem;
}

/* New container for member stats */
.member-stats-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  border-top: 1px solid var(--main-red-0_3);
  padding-top: 1.5rem;
  margin-top: 1rem;
  padding-bottom: 2rem;
}

.member-count,
.member-join {
  border: none;
  text-align: center;
}

.member-count {
  border-right: 1px solid var(--main-red-0_3);
  padding-right: 2rem;
}

.member-join {
  padding-left: 2rem;
}

@media (max-width: 550px) {
  .member-stats-container {
    flex-direction: column;
    gap: 1.5rem;
  }
  .member-count {
    border-right: none;
    border-bottom: 1px solid var(--main-red-0_3);
    padding-right: 0;
    padding-bottom: 1rem;
  }
  .member-join {
    padding-left: 0;
  }
  .placements-headers,
  .placement-item {
    grid-template-columns: 0.6fr 2.5fr;
  }
}

/* Date column adjustment */
.placements-headers,
.placement-item {
  /* Update grid to 3 columns: Rank Date Contest */
  grid-template-columns: 0.5fr 1.5fr 2fr;
}

.placement-date {
  color: #fff;
  opacity: 0.8;
  font-size: 1.2rem;
}

@media (max-width: 550px) {
  .placements-headers,
  .placement-item {
    grid-template-columns: 0.5fr 1.2fr 1.8fr;
  }
}

/* Chart Resizing Fix */
.chart-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  min-width: 0; /* Prevents overflow in flex items */
}

/* Ensure flex parents don't constrain rigidly, allowing shrink */
.data-stats-graphs .graph-01,
.data-stats-graphs .graph-02,
.team-graph {
  min-width: 0;
}

/* Filter Styles */
.header-with-filter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-container {
  position: relative;
  display: inline-block;
}

.year-filter {
  appearance: none;
  background-color: rgba(20, 20, 20, 0.9);
  border: 1px solid #d72638;
  color: #d72638;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  padding: 0.5rem 2rem 0.5rem 1rem;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  border-radius: 4px; /* Slight rounded corners */
  min-width: 100px;
}

.year-filter:hover,
.year-filter:focus {
  background-color: rgba(215, 38, 56, 0.1);
  box-shadow: 0 0 10px rgba(215, 38, 56, 0.2);
}

.year-filter option {
  background-color: #1a1a1a;
  color: #ffffff;
  padding: 10px;
}

/* Custom arrow for select */
.filter-container::after {
  content: "▼";
  font-size: 0.8rem;
  color: #d72638;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

@media (max-width: 768px) {
  .header-with-filter {
    flex-direction: column;
    align-items: center;
  }
}

.participant-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-color);
  padding: 0.5rem 0;
  display: inline-block;
}

.team-graph {
  height: 100%; /* Fill grid area */
  justify-content: space-between; /* Space out content nicely */
}

/* Ensure placements list takes available vertical space */
.placements-list {
  flex-grow: 1;
}
