/* Layout and indicators only. Typography comes from CTFd's native theme. */
.fb-admin,
.fb-matrix {
  --fb-fallback-surface: #fff;
  --fb-fallback-text: #212529;
  --fb-fallback-border: #dee2e6;
  --fb-fallback-header: #f8f9fa;
  --fb-fallback-muted: #495057;
  --fb-fallback-link: #337ab7;
  --fb-fallback-error: #b02a37;
  --fb-fallback-focus: #0d6efd;
  --fb-gold-ink: #856404;
  --fb-gold-fill: #fff3cd;
  --fb-silver-ink: #495057;
  --fb-silver-fill: #e9ecef;
  --fb-bronze-ink: #864313;
  --fb-bronze-fill: #ffead9;
  --fb-green-ink: #137b40;
  --fb-green-fill: #d5f5df;
  --fb-blue-ink: #1761be;
  --fb-blue-fill: #d9ebff;
  --fb-blood-ink: #a61b32;
  --fb-surface: var(--bs-body-bg, var(--fb-fallback-surface));
  --fb-text: var(--bs-body-color, var(--fb-fallback-text));
  --fb-border: var(--bs-border-color, var(--fb-fallback-border));
  --fb-header: var(--bs-tertiary-bg, var(--fb-fallback-header));
  --fb-muted: var(--bs-secondary-color, var(--fb-fallback-muted));
  --fb-link: var(--bs-link-color, var(--fb-fallback-link));
  --fb-error: var(--bs-danger-text-emphasis, var(--fb-fallback-error));
  --fb-focus: var(--bs-primary, var(--fb-fallback-focus));
}
/* Token-aware future themes can supply Bootstrap variables. Attribute-based
   dark themes without those variables still receive legible fallback colors. */
:where([data-bs-theme="dark"], [data-theme="dark"]) .fb-admin,
:where([data-bs-theme="dark"], [data-theme="dark"]) .fb-matrix,
.fb-admin:where([data-bs-theme="dark"], [data-theme="dark"]),
.fb-matrix:where([data-bs-theme="dark"], [data-theme="dark"]) {
  color-scheme: dark;
  --fb-fallback-surface: #212529;
  --fb-fallback-text: #dee2e6;
  --fb-fallback-border: #495057;
  --fb-fallback-header: #2b3035;
  --fb-fallback-muted: #adb5bd;
  --fb-fallback-link: #8dc0ff;
  --fb-fallback-error: #ff8ba0;
  --fb-fallback-focus: #8dc0ff;
  --fb-gold-ink: #ffd76b;
  --fb-gold-fill: #403516;
  --fb-silver-ink: #d2d6dc;
  --fb-silver-fill: #343a40;
  --fb-bronze-ink: #f3be92;
  --fb-bronze-fill: #442d22;
  --fb-green-ink: #75dca7;
  --fb-green-fill: #173929;
  --fb-blue-ink: #8dc0ff;
  --fb-blue-fill: #192f49;
  --fb-blood-ink: #ff8ba0;
}
.fb-panel {
  background-color: var(--fb-surface);
  color: var(--fb-text);
  border-color: var(--fb-border);
}
.fb-matrix-head {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}
.fb-table-wrap {
  overflow: auto;
  max-height: 38rem;
  margin-top: 1rem;
}
.fb-table {
  --bs-table-bg: var(--fb-surface);
  --bs-table-color: var(--fb-text);
  --bs-table-border-color: var(--fb-border);
  color: var(--fb-text);
  border-color: var(--fb-border);
}
.fb-table th,
.fb-table td {
  vertical-align: middle;
  border-color: var(--fb-border);
}
.fb-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: var(--fb-header);
  color: var(--fb-text);
}
.fb-table caption {
  color: var(--fb-muted);
}
.fb-table a {
  color: var(--fb-link);
}
.fb-challenge-header {
  min-width: 8rem;
  max-width: 11rem;
}
.fb-challenge-header > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}
.fb-challenge-header small {
  display: block;
}
.fb-completion {
  text-align: center;
}
.fb-indicator {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.fb-indicator small {
  position: absolute;
  bottom: -0.3rem;
  right: -0.4rem;
  min-width: 1rem;
  background-color: var(--fb-surface);
  color: var(--fb-text);
  border: 1px solid var(--fb-border);
}
.fb-blood {
  color: var(--fb-blood-ink);
  border: 0;
}
.fb-gold {
  color: var(--fb-gold-ink);
  background-color: var(--fb-gold-fill);
}
.fb-silver {
  color: var(--fb-silver-ink);
  background-color: var(--fb-silver-fill);
}
.fb-bronze {
  color: var(--fb-bronze-ink);
  background-color: var(--fb-bronze-fill);
}
.fb-green {
  color: var(--fb-green-ink);
  background-color: var(--fb-green-fill);
}
.fb-blue {
  color: var(--fb-blue-ink);
  background-color: var(--fb-blue-fill);
}
.fb-solved {
  color: var(--fb-green-ink);
}
.fb-unsolved {
  color: var(--fb-muted);
}
.fb-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
  justify-content: center;
}
.fb-pagination a {
  color: var(--fb-link);
}
.fb-rank-values {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}
.fb-rank-values label {
  width: 9rem;
}
.fb-admin .form-control {
  font-family: inherit;
  background-color: var(--fb-surface);
  color: var(--fb-text);
  border-color: var(--fb-border);
}
.fb-admin .form-control::placeholder {
  color: var(--fb-muted);
  opacity: 1;
}
.fb-admin .btn,
.fb-matrix .btn {
  font-family: inherit;
}
.fb-panel .btn-outline-secondary:not(:hover):not(:focus) {
  color: var(--fb-muted);
  border-color: var(--fb-muted);
}
.fb-panel .btn-outline-primary:not(:hover):not(:focus) {
  color: var(--fb-link);
  border-color: var(--fb-link);
}
.fb-panel .btn-outline-danger:not(:hover):not(:focus) {
  color: var(--fb-error);
  border-color: var(--fb-error);
}
#fb-message {
  padding: 0.75rem 0;
}
#fb-message[data-error="true"] {
  color: var(--fb-error);
}
.fb-table a:focus-visible,
.fb-panel button:focus-visible,
.fb-table-wrap:focus-visible {
  outline: 3px solid var(--fb-focus);
  outline-offset: 2px;
}
