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

:root {
  --color-404-club: #af131d;
  --color-guardians: #d4a017;
  --color-commit-cult: #1fad51;
  --color-stranger-strings: #d059ff;
  --bar-max-height: 680px;
  --bar-min-height: 80px;
  --bar-width: 185px;
  --badge-width: 100px;
  --badge-space: 140px;
  --page-max-width: 1440px;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #fff;
  background: #0a1628;
}

.leaderboard {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.leaderboard__background {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.leaderboard__background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.leaderboard__header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 94px 24px 0;
  text-align: center;
}

.leaderboard__logo {
  display: block;
  width: min(339px, 80vw);
  height: auto;
}

.leaderboard__title {
  max-width: 597px;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.leaderboard__date {
  font-size: clamp(0.875rem, 1.5vw, 1.125rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.leaderboard__teams {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  align-self: end;
  justify-self: center;
  gap: clamp(24px, 8.6vw, 124px);
  max-width: var(--page-max-width);
  width: 100%;
  min-height: 0;
  padding: 0 24px 24px;
}

.team {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: var(--bar-width);
  flex-shrink: 0;
}

.team__bar-track {
  position: relative;
  width: 100%;
  height: calc(var(--bar-max-height) + var(--badge-space));
  overflow: visible;
}

.team__bar-track--instant .team__bar,
.team__bar-track--instant .team__badge {
  transition: none;
}

.team__bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: max(
    var(--bar-min-height),
    calc(var(--bar-max-height) * var(--bar-fill, 0%) / 100%)
  );
  transition: height 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.team__badge {
  position: absolute;
  left: 50%;
  bottom: max(
    var(--bar-min-height),
    calc(var(--bar-max-height) * var(--bar-fill, 0%) / 100%)
  );
  transform: translateX(-50%);
  display: block;
  width: var(--badge-width);
  height: auto;
  z-index: 2;
  transition: bottom 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.team[data-team="404-club"] .team__bar {
  background-color: var(--color-404-club);
}

.team[data-team="guardians"] .team__bar {
  background-color: var(--color-guardians);
}

.team[data-team="commit-cult"] .team__bar {
  background-color: var(--color-commit-cult);
}

.team[data-team="stranger-strings"] .team__bar {
  background-color: var(--color-stranger-strings);
}

.team__points {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.team__score {
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.team__label {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.2;
}

.team__delta {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

.team__delta-icon {
  font-size: 9px;
  font-weight: 700;
}

.admin-page {
  min-height: 100vh;
  min-height: 100dvh;
}

.admin {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.admin__header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  position: relative;
}

.admin__logout {
  position: absolute;
  top: 0;
  right: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  text-decoration: none;
}

.admin__logout:hover {
  color: #fff;
}

.admin__back {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  text-decoration: none;
}

.admin__back:hover {
  color: #fff;
}

.admin__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin__subtitle {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.5;
  opacity: 0.75;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.admin-form__team-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-form__field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.85;
}

.login__form {
  margin-top: 0;
}

.login__error {
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(175, 19, 29, 0.25);
  border: 1px solid rgba(175, 19, 29, 0.5);
  color: #ffb3b3;
  font-size: 0.875rem;
}

.admin-form__field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 1rem;
}

.admin-form__field input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}

.date-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-picker__display {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.date-picker__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.date-picker__trigger {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}

.date-picker__trigger:hover {
  background: rgba(255, 255, 255, 0.12);
}

.date-picker__display:focus,
.date-picker__trigger:focus {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}

.admin-form__submit {
  padding: 12px 18px;
  margin-top: 8px;
  border: none;
  border-radius: 6px;
  background: #fff;
  color: #0a1628;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.admin-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-form__cancel {
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.admin-entries {
  margin-top: 40px;
}

.admin-entries__title {
  margin-bottom: 16px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.admin-entries__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
}

.admin-entries__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.admin-entries__item--editing {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.07);
}

.admin-entries__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.admin-entries__actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.admin-entries__btn {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.admin-entries__btn--danger {
  border-color: rgba(255, 120, 120, 0.45);
  color: #ffb4b4;
}

.admin-entries__date {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
}

.admin-entries__summary {
  font-size: 0.8125rem;
  font-weight: 300;
  line-height: 1.4;
  opacity: 0.75;
}

.admin-entries__empty {
  font-size: 0.875rem;
  font-weight: 300;
  opacity: 0.6;
}

@media (max-width: 1100px) {
  :root {
    --bar-max-height: 550px;
    --bar-min-height: 68px;
    --bar-width: 150px;
    --badge-width: 82px;
    --badge-space: 115px;
  }

  .leaderboard__teams {
    gap: 20px;
  }

  .team__score {
    font-size: 22px;
  }

  .team__label {
    font-size: 13px;
  }

  .team__delta {
    font-size: 9px;
  }

  .team__delta-icon {
    font-size: 8px;
  }
}

@media (max-width: 760px) {
  :root {
    --bar-max-height: min(
      420px,
      calc((100dvh - 220px - 40px) / 2 - var(--badge-space))
    );
    --bar-min-height: 58px;
    --bar-width: 120px;
    --badge-width: 68px;
    --badge-space: 100px;
  }

  .leaderboard__header {
    padding-top: 48px;
    gap: 16px;
  }

  .leaderboard__teams {
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    align-content: flex-end;
    row-gap: 40px;
  }

  .team {
    width: calc(50% - 16px);
    max-width: 160px;
  }

  .team__score {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  :root {
    --bar-max-height: min(
      340px,
      calc((100dvh - 200px - 32px) / 2 - var(--badge-space))
    );
    --bar-min-height: 54px;
    --badge-width: 58px;
    --badge-space: 84px;
  }

  .leaderboard__teams {
    row-gap: 32px;
    padding-bottom: 16px;
  }

  .team {
    width: calc(50% - 12px);
    max-width: 140px;
  }

  .team__score {
    font-size: 16px;
  }

  .team__label {
    font-size: 11px;
  }
}
