html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  background: #f6f7f9;
  margin-bottom: 60px;
}

.navbar {
  background: #fff !important;
}

.surface,
.empty-state {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}

.empty-state {
  color: #6b7280;
  text-align: center;
}

.phase-heading {
  align-items: baseline;
  color: #111827;
  display: flex;
  font-size: 1rem;
  font-weight: 700;
  gap: .5rem;
  margin: 1.25rem 0 .5rem;
}

.phase-heading span {
  color: #6b7280;
  font-size: .9rem;
  font-weight: 500;
}

.phase-collapsible {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: .75rem;
}

.phase-collapsible + .phase-collapsible {
  margin-top: .75rem;
}

.phase-collapsible > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  list-style: none;
}

.phase-collapsible > summary::-webkit-details-marker {
  display: none;
}

.phase-collapsible > summary::before {
  color: #0f766e;
  content: "+";
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.phase-collapsible[open] > summary::before {
  content: "-";
}

.phase-collapsible > summary span:first-child {
  color: #111827;
  font-size: 1.15rem;
  font-weight: 800;
  margin-right: auto;
}

.phase-collapsible[open] > summary {
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: .75rem;
  padding-bottom: .75rem;
}

.deadline-pill {
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 999px;
  color: #155e75 !important;
  font-size: .75rem !important;
  padding: .15rem .55rem;
}

.deadline-locked {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b !important;
}

.match-list {
  display: grid;
  gap: .5rem;
}

.match-row {
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: grid;
  gap: .5rem;
  grid-template-columns: minmax(7rem, 1fr) 4.25rem 2rem 4.25rem minmax(7rem, 1fr) minmax(8rem, auto);
  padding: .65rem;
}

.team {
  align-items: center;
  color: #111827;
  display: flex;
  gap: .45rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.team-home {
  justify-content: flex-end;
}

.team-away {
  justify-content: flex-start;
}

.flag {
  border: 1px solid #e5e7eb;
  border-radius: 2px;
  display: block;
  flex: 0 0 auto;
  height: 18px;
  object-fit: cover;
  width: 27px;
}

.score-input {
  min-width: 0;
  text-align: center;
}

.versus {
  color: #6b7280;
  font-size: .8rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.actual-score {
  color: #6b7280;
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.goal-scorers {
  border-top: 1px solid #f1f5f9;
  display: grid;
  gap: .75rem;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: .65rem;
}

.goal-scorers .form-label {
  color: #6b7280;
  font-size: .8rem;
  margin-bottom: .25rem;
}

.knockout-controls {
  border-top: 1px solid #f1f5f9;
  display: grid;
  gap: .75rem;
  grid-column: 1 / -1;
  grid-template-columns: minmax(12rem, 1.2fr) minmax(10rem, 1fr) 8rem 8rem;
  padding-top: .65rem;
}

.knockout-controls .form-label {
  color: #6b7280;
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: .25rem;
}

.knockout-breakdown {
  grid-column: 1 / -1;
}

.result-flags {
  border-top: 1px solid #f1f5f9;
  color: #6b7280;
  display: flex;
  gap: 1rem;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: .55rem;
}

.result-flags .form-check {
  margin-bottom: 0;
}

.schedule-row {
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(11rem, 1.1fr) minmax(10rem, 1fr) minmax(10rem, 1fr) 14rem auto;
  padding: .75rem;
}

.schedule-match {
  display: grid;
  gap: .1rem;
}

.schedule-match strong {
  color: #111827;
}

.schedule-match span {
  color: #111827;
  font-weight: 600;
}

.schedule-match small {
  color: #6b7280;
}

.schedule-team .form-label,
.schedule-kickoff .form-label {
  color: #6b7280;
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: .25rem;
}

.schedule-clear {
  margin-bottom: 0;
}

.sticky-actions {
  align-items: center;
  background: rgba(255, 255, 255, .95);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  bottom: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding: .75rem;
  position: sticky;
}

.leaderboard .score-total {
  color: #0f766e;
  font-size: 1.25rem;
  font-weight: 800;
}

.leaderboard-score-pack {
  align-items: stretch;
  display: grid;
  gap: .45rem;
  grid-template-columns: 5.5rem 5.5rem 7.5rem;
  min-width: 19rem;
}

.score-total-block,
.score-phase-block {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: .45rem .55rem;
}

.score-total-block {
  background: #ecfdf5;
  border-color: #99f6e4;
}

.score-phase-knockout {
  background: #fff7ed;
  border-color: #fed7aa;
}

.score-total-block span,
.score-phase-block span {
  color: #6b7280;
  display: block;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.score-total-block strong,
.score-phase-block strong {
  color: #111827;
  display: block;
  font-size: 1.35rem;
  line-height: 1.15;
  margin-top: .2rem;
}

.score-total-block strong {
  color: #0f766e;
  font-size: 1.65rem;
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, .8fr);
}

.dashboard-main,
.dashboard-results {
  grid-column: span 1;
}

.dashboard-results {
  grid-column: 1 / -1;
}

.ranking-list,
.result-list {
  display: grid;
  gap: .5rem;
}

.group-standings-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.group-standing .table {
  font-size: .85rem;
}

.group-standing {
  min-width: 0;
}

.group-standing td:nth-child(n+3),
.group-standing th:nth-child(n+3) {
  min-width: 2.25rem;
}

.ranking-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: grid;
  gap: .75rem;
  grid-template-columns: 2.25rem 1fr auto;
  padding: .75rem;
}

.ranking-position {
  align-items: center;
  background: #0f766e;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.ranking-name {
  font-weight: 700;
}

.ranking-score {
  color: #0f766e;
}

.dashboard-match {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: .75rem;
}

.match-meta {
  color: #6b7280;
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.dashboard-teams {
  align-items: center;
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.dashboard-score {
  color: #111827;
  font-weight: 900;
  min-width: 3.5rem;
  text-align: center;
}

.money-summary {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.money-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: .85rem;
}

.money-card span {
  color: #6b7280;
  display: block;
  font-size: .85rem;
  font-weight: 700;
}

.money-card strong {
  color: #0f766e;
  display: block;
  font-size: 1.35rem;
  margin-top: .25rem;
}

.admin-actions {
  min-width: 27rem;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
  max-width: 56rem;
}

.admin-toolbar form {
  margin: 0;
}

.payment-form {
  display: inline-block;
  margin-right: .5rem;
  max-width: 20rem;
  vertical-align: middle;
}

.access-code-form {
  margin-left: auto;
  max-width: 18rem;
}

.payment-amount {
  max-width: 5.5rem;
}

.live-penalty-score {
  margin-left: auto;
  max-width: 9rem;
}

@media (max-width: 768px) {
  .match-row {
    grid-template-columns: 1fr 3.5rem 1.5rem 3.5rem 1fr;
  }

  .actual-score {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .goal-scorers {
    grid-template-columns: 1fr;
  }

  .knockout-controls {
    grid-template-columns: 1fr;
  }

  .result-flags {
    justify-content: center;
  }

  .schedule-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .sticky-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .group-standings-grid {
    grid-template-columns: 1fr;
  }

  .money-summary {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    min-width: 18rem;
  }

  .admin-toolbar {
    justify-content: flex-start;
    max-width: 100%;
    width: 100%;
  }

  .admin-toolbar .btn,
  .admin-toolbar form {
    flex: 1 1 11rem;
  }

  .admin-toolbar form .btn {
    width: 100%;
  }

  .leaderboard-score-pack {
    grid-template-columns: repeat(3, minmax(4.75rem, 1fr));
    min-width: 15rem;
  }

  .score-total-block strong,
  .score-phase-block strong {
    font-size: 1.1rem;
  }

  .score-total-block strong {
    font-size: 1.3rem;
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
