:root {
  --phosphor: #5ff5ff;
  --phosphor-dim: #36aebe;
  --phosphor-faint: #1b6678;
  --background: #00101f;
  --background-deep: #000b16;
  --error: #ff8f8f;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--phosphor);
  background: var(--background-deep);
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.32;
  text-shadow:
    0 0 2px var(--phosphor),
    0 0 8px rgba(95, 245, 255, 0.34);
}

body::before {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0.28) 4px
  );
}

body::after {
  position: fixed;
  z-index: 11;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.42) 100%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.018), transparent 35%, rgba(0, 90, 255, 0.025));
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 1px dashed var(--phosphor);
  outline-offset: 3px;
}

.shell {
  position: relative;
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 13px 28px;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 7px,
      rgba(47, 190, 205, 0.014) 8px
    ),
    var(--background);
}

.masthead h1,
.masthead p,
.terminal h2,
.leaderboard h2,
.leaderboard p,
.instructions p,
.form-message,
footer {
  margin: 0;
}

.masthead h1 {
  font-size: 1em;
}

.masthead p {
  color: var(--phosphor-dim);
}

.masthead span,
.status-prefix,
.record-count {
  color: var(--phosphor);
}

.rule {
  width: 100%;
  margin: 8px 0 18px;
  overflow: hidden;
  color: var(--phosphor-faint);
  font-weight: 400;
  white-space: nowrap;
}

.terminal,
.leaderboard {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.timer-display {
  margin: 2px 0 3px;
  color: var(--phosphor);
  font-size: clamp(3.2rem, 9vw, 6.8rem);
  line-height: 1.02;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer-display.armed {
  color: #ffffff;
  text-shadow: 0 0 3px #fff, 0 0 12px var(--phosphor);
}

.timer-display.running {
  color: #ffffff;
}

.timer-status {
  min-height: 1.32em;
}

.instructions {
  margin: 22px 0;
}

.solve-form {
  display: block;
}

.field {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 1.75em;
}

.field label {
  flex: 0 0 145px;
}

.input-wrap {
  display: inline-flex;
  min-width: 0;
  align-items: baseline;
  flex: 1;
}

.input-wrap b {
  margin-right: 10px;
  color: var(--phosphor);
}

.input-wrap input {
  width: min(480px, 100%);
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--phosphor-faint);
  border-radius: 0;
  outline: 0;
  color: #ffffff;
  background: transparent;
  text-shadow: 0 0 6px rgba(95, 245, 255, 0.5);
}

.input-wrap input:focus {
  border-bottom-color: var(--phosphor);
}

.input-wrap input::placeholder {
  color: var(--phosphor-faint);
}

.command-button,
.pagination button {
  padding: 0;
  border: 0;
  color: var(--phosphor);
  background: transparent;
  font-weight: 700;
  text-shadow: inherit;
  cursor: pointer;
}

.command-button {
  display: block;
  margin-top: 13px;
}

.command-button:hover:not(:disabled),
.pagination button:hover:not(:disabled) {
  color: #ffffff;
  text-decoration: underline;
}

button:disabled {
  color: var(--phosphor-faint);
  cursor: not-allowed;
  opacity: 1;
}

.form-message {
  min-height: 1.32em;
  margin-top: 4px;
}

.form-message:not(.visible) {
  visibility: hidden;
}

.form-message.error {
  color: var(--error);
}

.leaderboard {
  margin-top: 29px;
}

.leaderboard > p {
  color: var(--phosphor-dim);
}

.record-count {
  margin-top: 9px !important;
}

.table-frame {
  width: 100%;
  margin-top: 8px;
  overflow-x: auto;
}

table {
  width: 100%;
  border: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 1em;
}

th,
td {
  padding: 0 14px 0 0;
  border: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  color: var(--phosphor);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

th:nth-child(1),
td:nth-child(1) {
  width: 9%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 23%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 22%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 19%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 27%;
}

td {
  color: var(--phosphor);
}

.time-cell {
  color: #ffffff;
}

.date-cell {
  color: var(--phosphor-dim);
}

.loading,
.empty {
  height: 2.64em;
  color: var(--phosphor-dim);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 16px;
}

.pagination span {
  color: var(--phosphor-dim);
}

.leaderboard + .rule {
  margin-top: 28px;
  margin-bottom: 8px;
}

footer {
  color: var(--phosphor-dim);
}

.cursor {
  display: block;
  color: var(--phosphor);
}

.cursor i {
  font-style: normal;
}

.blink {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .shell {
    padding: 7px 8px 22px;
  }

  .timer-display {
    font-size: clamp(2.8rem, 17vw, 5rem);
  }

  .field {
    display: block;
    margin-bottom: 8px;
  }

  .field label {
    display: block;
  }

  .input-wrap {
    width: 100%;
  }

  table {
    min-width: 580px;
  }

  .pagination {
    justify-content: space-between;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blink {
    animation: none;
  }
}
