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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a1e;
  font-family: "Barlow", sans-serif;
  font-weight: 400;
  font-style: normal;
  color: #e0e0e0;
  padding: 2rem;
  gap: 2.5rem;
}

.barlow-regular {
  font-family: "Barlow", sans-serif;
  font-weight: 400;
  font-style: normal;
}

h1 {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.teams {
  display: flex;
  width: 100%;
  height: calc(
    var(--top-bar-height) +
    var(--score-section-height)
  );
}

/* Main scoreboard */
.scoreboard {
  --scale: 1.5;

  --top-bar-height: calc(25px * var(--scale));
  --score-ratio: 2.3;
  --score-section-height: calc(
    var(--top-bar-height) * var(--score-ratio)
  );

  --progress-height: calc(23px * var(--scale));

  --score-font-size: calc(2.8rem * var(--scale));
  --player-font-size: calc(1.1rem * var(--scale));
  --marker-size: calc(14px * var(--scale));
  --icon-size: calc(24px * var(--scale));

  display: flex;
  flex-direction: column;

  min-width: calc(720px * var(--scale) / 1.5);

  background: linear-gradient(
    180deg,
    #2a2a30 0%,
    #1e1e24 100%
  );

  overflow: hidden;

  box-shadow:
    0 12px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.05);

  position: relative;
}
.team {
  /*
   * Each team is now a grid column.
   */
  min-width: 0;

  display: flex;
  flex: auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: var(--top-bar-height) 0 0;

  position: relative;

  transition:
    background 0.35s ease,
    box-shadow 0.35s ease;
}

.team.blue {
  background: #130f0e;
}

.team.red {
  background: #2c0f0d;
}

.team.green {
  background: #0d0d0d;
}

.team.leading {
  box-shadow: inset 0 0 40px rgba(255,255,255,0.04);
}

.team.blue.leading .score .significant {
  color: #afddfe;
}

.team.red.leading .score .significant {
  color: #fe9291;
}

.team.green.leading .score .significant {
  color: #94ccb5;
}
/* Top indicator bar */
.top-bar {
  position: absolute;

  top: 0;
  left: 0;
  right: 0;

  height: var(--top-bar-height);

  display: flex;

  z-index: 10;

  pointer-events: none;
}

.top-segment {
  flex: 1;
  transition: background 0.35s ease;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: calc(var(--marker-size) * .7);
  background: #2a2627ff;
}

.top-segment.blue.leading {
  background: #55acef;
}

.top-segment.red.leading {
  background: #f13e2d;
}

.top-segment.green.leading {
  background: #07ec4a;
}

/* Team markers inside top bar */
.team-marker {
  width: var(--marker-size);
  height: var(--marker-size);
  flex-shrink: 0;
  transition: background 0.35s ease, border-top-color 0.35s ease;
}

.team-marker.square {
  background: #2378a8;
  border-radius: 2px;
}

.team-marker.triangle {
  width: 0;
  height: 0;
  background: transparent;
  border-left: calc(var(--marker-size) * 0.57) solid transparent;
  border-right: calc(var(--marker-size) * 0.57) solid transparent;
  border-top: var(--marker-size) solid #cd493b;
}

.team-marker.circle {
  background: #48a93e;
  border-radius: 50%;
}

/* Marker colors when team is highlighted */
.top-segment.blue.leading .team-marker.square {
  background: #4384bc;
}

.top-segment.red.leading .team-marker.triangle {
  border-top-color: #af2d23;
}

.top-segment.green.leading .team-marker.circle {
  background: #008132;
}

.score .significant {
  opacity: 1;
  transition: color 0.35s ease;
}

.team .score .leading-zeros {
  color: #383838;
  opacity: 1;
  transition: color 0.35s ease;
}

.team.leading .score .leading-zeros {
  color: #808080;
}

.score-row {
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--score-section-height);
}

.score {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  font-size: calc(var(--score-font-size) * 1.2);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.player-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  height: 100%;
}

.player-icon {
  width: var(--icon-size);
  height: var(--icon-size);
}

.team.blue .player-icon {
  color: #289dea;
}

.team.red .player-icon {
  color: #f73e34;
}

.team.green .player-icon {
  color: #02c448;
}

.player-count {
    font-size: calc(var(--player-font-size) * 1.2);
    font-weight: 500;
    color: #b8b1b0;
    opacity: 1;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Team colors */
.team.blue,
.top-segment.blue  { color: #5b9fff; }
.team.red,
.top-segment.red   { color: #ff5b5b; }
.team.green,
.top-segment.green { color: #5bff9a; }

.team.blue  .score { color: #476577; }
.team.red   .score { color: #8d635a; }
.team.green .score { color: #337347; }

/* Divider lines */
/* .team + .team::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: rgba(255,255,255,0.08);
} */

/* Controls panel */
.controls {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.control-card {
  background: #25252c;
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  border: 1px solid rgba(255,255,255,0.06);
  min-width: 200px;
}

.control-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-card h3 .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  font-size: 0.75rem;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input {
  background: #1a1a20;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  width: 100%;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus {
  border-color: rgba(255,255,255,0.3);
}


/* SVG person icon */
.player-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}


.export-controls {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

#export-png {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: #3478f6;
  color: white;
  font-family: 'Barlow', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

#export-png:hover {
  background: #245dcc;
}

#export-png:disabled {
  opacity: 0.6;
  cursor: wait;
}

a {
  color: #d7944c;
}

p.hint{
  font-size: 0.8rem;
  max-width: 480px;
  line-height: 1.5;
  color: white;
}

.footer {
    width: 100%
}

/* =========================
   CUSTOM PROGRESS BAR
   ========================= */

   .progress-bar-container {
     grid-column: 1 / -1;
     grid-row: 2;

     width: 100%;
     height: var(--progress-height);

     position: relative;
     overflow: hidden;

     background: #202020;
     z-index: 5;
   }

/* The colored progress fill */
.progress-bar {
  position: absolute;
  left: 0;
  top: 0;

  width: 50%;
  height: 100%;

  background: #5b9fff;

  transition:
    width 0.2s ease,
    background-color 0.2s ease;

  z-index: 1;
}

/* Label ABOVE the progress fill */
.progress-bar-container > span {
  position: absolute;

  left: 20px;
  top: 0;

  width: calc(100% - 16px);
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: flex-start;

  color: white;

  font-family: "Barlow", sans-serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 4px;
  line-height: 1;
  white-space: nowrap;

  pointer-events: none;

  /*
   * Critical:
   * This puts the text above the colored fill.
   */
  z-index: 2;

}

/* =========================================================
   PROGRESS COLOR OPTIONS
   ========================================================= */

.color-options {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* ---------------------------------------------------------
   COLOR CIRCLE
   --------------------------------------------------------- */

.color-option {
  width: 30px;
  height: 30px;

  flex-shrink: 0;

  padding: 0;

  border: 2px solid transparent;
  border-radius: 50%;

  cursor: pointer;

  position: relative;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}


/* ---------------------------------------------------------
   PRESET COLORS
   --------------------------------------------------------- */

.color-option.blue {
  background: #396478ff;
}

.color-option.red {
  background: #781e16ff;
}

.color-option.green {
  background: #004424ff;
}

.color-option.bg.blue {
  background: #0c1921ff;
}

.color-option.bg.red {
  background: #190401ff;
}

.color-option.bg.green {
  background: #000c02ff;
}
/* ---------------------------------------------------------
   ACTIVE PRESET
   --------------------------------------------------------- */

.color-option.active {
  border-color: #ffffff;

  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.2);
}


/* ---------------------------------------------------------
   HOVER
   --------------------------------------------------------- */

.color-option:hover {
  transform: scale(1.1);
}


/* ---------------------------------------------------------
   CUSTOM COLOR CIRCLE
   --------------------------------------------------------- */

.color-option.custom {
  /*
   * Checkerboard makes the custom circle visibly
   * different from the preset circles.
   */
  background:
    conic-gradient(
      #ffffff 25%,
      #cccccc 0 50%,
      #ffffff 0 75%,
      #cccccc 0
    )
    0 0 / 8px 8px;

  overflow: hidden;
}


/*
 * The actual native color picker remains functional,
 * but fills the entire circle.
 */

.color-option.custom input[type="color"] {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  padding: 0;

  border: 0;

  opacity: 0;

  cursor: pointer;
}


/*
 * Show the currently selected custom color in the circle.
 */

.color-option.custom.has-color {
  background: var(--custom-color);
}


/* ---------------------------------------------------------
   CUSTOM ACTIVE STATE
   --------------------------------------------------------- */

.color-option.custom.active {
  border-color: #ffffff;

  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.2);
}
