/* Spectator copy of the CTF-Unplugged CTFd theme: only what the scoreboard
 * page needs, without Bootstrap. No external fonts or assets. */

:root {
  --up-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo,
    Consolas, "Liberation Mono", monospace;
  --up-sans: Lato, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* The timer bar and page header are dark in both colour modes */
  --up-bar-bg: #0b0c0e;
  --up-bar-surface: #17191e;
  --up-bar-line: #2a2e37;
  --up-bar-text: #e8e6e1;
  --up-bar-muted: #9a9ca3;
  --up-header-bg: #000000;
  --up-gold: #f2c230;
  --up-red: #ff5a4f;

  color-scheme: dark;
  --up-bg: #0e0f12;
  --up-surface: #17191e;
  --up-line: #2a2e37;
  --up-text: #e8e6e1;
  --up-muted: #9a9ca3;
  --up-accent-text: #f2c230;
  --up-green: #2fd67b;
  --up-check: #4a505c;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --up-bg: #f4f1ea;
    --up-surface: #ffffff;
    --up-line: #d6d0c2;
    --up-text: #16171a;
    --up-muted: #5d6068;
    --up-accent-text: #7d5b00;
    --up-green: #0f7a41;
    --up-check: #c9c2b2;
  }
}

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

[hidden] {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background-color: var(--up-bg);
  color: var(--up-text);
  font-family: var(--up-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

main {
  flex: 1 0 auto;
}

::selection {
  background: var(--up-gold);
  color: #14151a;
}

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

/* Timer bar (navbar)
-------------------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  padding: 0.5rem 0;
  background-color: var(--up-bar-bg);
  border-bottom: 1px solid var(--up-bar-line);
}

.navbar .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0;
  font-family: var(--up-mono);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--up-bar-text);
}

.up-plug {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  color: var(--up-bar-text);
}

.up-plug .up-plug-prongs {
  fill: var(--up-gold);
}

.up-timer {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--up-bar-line);
  border-radius: 0.25rem;
  background: var(--up-bar-surface);
  font-family: var(--up-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  white-space: nowrap;
}

.up-timer-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--up-bar-muted);
}

.up-timer-digits {
  font-size: 1rem;
  font-weight: 700;
  color: var(--up-gold);
}

.up-tenths {
  font-size: 0.75em;
  opacity: 0.65;
}

[data-up-state="pending"] .up-timer-digits {
  color: var(--up-bar-text);
}

[data-up-state="final"] .up-timer-digits {
  color: var(--up-red);
}

[data-up-state="over"] .up-timer-digits {
  color: var(--up-bar-muted);
}

@media (prefers-reduced-motion: no-preference) {
  .up-timer[data-up-state="final"] .up-timer-digits {
    animation: up-pulse 1s steps(2, jump-none) infinite;
  }
}

@keyframes up-pulse {
  50% {
    opacity: 0.55;
  }
}

/* Page header
-------------------------------------------------- */

.jumbotron {
  padding: 2.25rem 0 1.25rem;
  margin-bottom: 1.5rem;
  background-color: var(--up-header-bg);
  border-bottom: 1px solid var(--up-line);
}

.jumbotron h1 {
  margin: 0;
  padding-left: 0.9rem;
  border-left: 4px solid var(--up-gold);
  font-family: var(--up-mono);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--up-bar-text);
}

@media (min-width: 576px) {
  .jumbotron {
    padding: 3rem 0 1.5rem;
  }
}

/* Scoreboard: numbers line up like split times
-------------------------------------------------- */

.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin: 0 0 0.75rem auto;
  font-family: var(--up-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--up-muted);
  cursor: pointer;
  user-select: none;
}

.view-toggle input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--up-gold);
  cursor: pointer;
}

.table-scroll {
  margin-bottom: 1rem;
  overflow-x: auto;
}

#scoreboard table {
  width: 100%;
  border-collapse: collapse;
}

#scoreboard th,
#scoreboard td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--up-line);
  text-align: center;
  vertical-align: middle;
}

#scoreboard thead th {
  vertical-align: bottom;
  font-family: var(--up-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--up-muted);
}

#scoreboard thead th.place {
  width: 10px;
  padding-left: 1rem;
  text-align: left;
}

#scoreboard thead th.team {
  padding-left: 1rem;
  text-align: left;
}

/* Challenge columns: category groups over vertical challenge names */
#scoreboard thead th.category {
  padding: 0.5rem 0.5rem 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--up-accent-text);
}

#scoreboard thead th.chal {
  padding: 0.6rem 0.35rem;
}

#scoreboard thead th.chal span {
  display: inline-block;
  max-height: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--up-text);
}

#scoreboard .group-start {
  border-left: 1px solid var(--up-line);
}

#scoreboard tbody tr:nth-child(odd) {
  background-color: var(--up-surface);
}

#scoreboard tbody th.place,
#scoreboard tbody td.score {
  font-family: var(--up-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

#scoreboard tbody td {
  padding: 0.8rem 1rem;
}

#scoreboard tbody td.team {
  min-width: 9rem;
  text-align: left;
  overflow-wrap: anywhere;
}

#scoreboard tbody td.chal {
  width: 2.25rem;
  padding: 0.5rem 0.4rem;
}

#scoreboard tbody tr:first-child th.place,
#scoreboard tbody tr:first-child td.score {
  color: var(--up-accent-text);
}

.check {
  position: relative;
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--up-check);
  border-radius: 0.2rem;
  vertical-align: middle;
}

.check.solved {
  border-color: var(--up-green);
  background-color: var(--up-green);
}

.check.solved::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.3rem;
  height: 0.6rem;
  border: solid var(--up-bg);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.notice {
  margin: 1rem 0;
  font-family: var(--up-mono);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--up-muted);
}

/* Footer
-------------------------------------------------- */

.footer {
  padding: 1.25rem 0;
  font-family: var(--up-mono);
  font-size: 0.8rem;
  text-align: center;
}

.footer .up-footer-name {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--up-muted);
}
