@font-face {
  font-family: "Analog Whispers";
  src: url("assets/fonts/Analog Whispers FREE.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07151b;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.82);
  --southgate: #0099cd;
  --southgate-deep: #0b4d63;
  --southgate-soft: #7ad4ef;
  --line: rgba(122, 212, 239, 0.55);
  --panel: rgba(8, 32, 40, 0.78);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: transparent;
  color: var(--ink);
  font-family: "Analog Whispers", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

body {
  display: flex;
  justify-content: center;
}

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
}

.interstitial-wrapper {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 4px solid var(--southgate-deep);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--southgate);
}

.runner-container {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  overflow: hidden;
  transform: none !important;
}

.runner-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  background: var(--bg);
}

#offline-resources,
.icon-offline { display: none !important; }

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(7, 21, 27, 0.35);
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
}

.game-overlay[hidden] { display: none; }

.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(320px, 100%);
  max-height: 100%;
  text-align: center;
}

#overlay-start {
  width: min(640px, 100%);
}

#overlay-over {
  width: min(560px, 100%);
  min-height: 0;
}

#overlay-board {
  width: 100%;
  height: 100%;
  max-height: 100%;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  padding: 12px 14px 16px;
}

#overlay-board .board-split {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

#overlay-board .board-column {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#overlay-board .board-kicker {
  margin: 0 0 4px;
  font-size: 1.15rem;
  text-transform: uppercase;
  color: var(--southgate-soft);
}

#overlay-board .board-panel {
  width: 100%;
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  background: rgba(12, 40, 52, 0.94);
  border: 3px solid #101010;
  border-radius: 12px;
  padding: 8px 12px 10px;
}

#overlay-board .board-panel::before {
  content: none;
  display: none;
}

#board-slot .board thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0c2834;
  box-shadow: 0 1px 0 #0c2834;
}

#overlay-board .over-invite {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
}

.overlay-card[hidden] { display: none; }

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--southgate-soft);
}

.lede {
  margin: 0;
  max-width: 34rem;
  font-size: 1.05rem;
  line-height: 1.35;
  color: #ffffff;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7.5vw, 3.6rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.05;
  white-space: nowrap;
  color: #ffffff;
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--southgate-soft);
}

.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(18.5rem, 100%);
  padding: 12px 16px 10px;
  background: var(--southgate);
  border: 3px solid #101010;
  border-radius: 12px;
  box-shadow: 0 4px 0 #101010;
}

.score-card[hidden] { display: none !important; }

.over-score {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
  color: #ffffff;
}

.score-card .initials-label,
.score-card .note {
  color: #ffffff;
}

.board-split {
  display: flex;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  min-height: 0;
}

#over-split[hidden],
.board-split[hidden] {
  display: none !important;
}

.over-board,
.board-panel,
#board-slot {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 9.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 153, 205, 0.55) transparent;
}

.board-split .board-panel,
.board-split .over-board {
  flex: 1 1 55%;
  max-height: 11rem;
}

.board-split .board-panel::before {
  content: "Top 10";
  display: block;
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--southgate-soft);
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 4px;
  background: rgba(7, 40, 52, 0.94);
}

.over-invite {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: max-content;
  justify-items: stretch;
  align-content: center;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

.campus-toggle,
.campus-choices,
.over-invite .again-under-invite {
  grid-column: 1;
}

.campus-toggle,
.campus-choices { grid-row: 1; }

.over-invite .again-under-invite { grid-row: 2; }

.campus-choices {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  align-self: stretch;
}

.campus-choices[hidden] { display: none !important; }

.over-invite.is-choosing .campus-toggle { display: none; }

.over-invite.is-choosing .campus-choices { display: grid; }

.over-invite .invite-btn,
.game-overlay .over-invite .again-under-invite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  border: 3px solid #101010;
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.25;
  box-shadow: 0 4px 0 #101010;
}

.invite-btn {
  text-decoration: none;
  background: var(--southgate);
  color: var(--ink);
}

.again-under-invite {
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.invite-btn:hover,
.again-under-invite:hover { filter: brightness(1.08); }

.over-board h2 {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 4px;
  background: rgba(7, 40, 52, 0.94);
}

#overlay-over > button,
#overlay-board > button {
  flex-shrink: 0;
}

.board-nudge {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
  flex: 0 0 auto;
  padding: 2px 0;
}

.nudge-btn i {
  display: block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.nudge-btn[data-dir="-1"] i { border-bottom: 8px solid #ffffff; }
.nudge-btn[data-dir="1"] i { border-top: 8px solid #ffffff; }

.nudge-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 420px) {
  .board-split {
    flex-direction: column;
    align-items: center;
  }

  .board-split .board-panel,
  .over-invite {
    width: 100%;
    flex: none;
  }

  #overlay-board .board-column {
    width: 100%;
    flex: 1 1 auto;
  }

  #overlay-board .over-invite {
    width: max-content;
  }

  .board-nudge {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    align-self: center;
  }
}

#overlay-board .board-split,
#overlay-over:has(#over-split:not([hidden])) #over-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: stretch;
  height: 100%;
}

#overlay-board .board-split {
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 14px;
  row-gap: 4px;
}

#overlay-board .board-column {
  display: contents;
}

#overlay-board .board-kicker {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
}

#overlay-board .board-panel {
  grid-column: 1;
  grid-row: 2;
}

#overlay-over:has(#over-split:not([hidden])) {
  width: 100%;
  height: 100%;
  max-height: 100%;
  align-items: stretch;
  padding: 12px 14px 16px;
}

#overlay-board .board-column,
#over-split .over-board {
  grid-column: 1;
  grid-row: 1;
  width: auto;
  max-width: none;
  max-height: none;
}

#overlay-board .board-nudge {
  grid-column: 2;
  grid-row: 2;
}

#over-split .board-nudge {
  grid-column: 2;
  grid-row: 1;
}

#overlay-board .board-nudge,
#over-split .board-nudge {
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
}

#overlay-board .over-invite {
  grid-row: 3;
  margin-top: 10px;
}

#over-split .over-invite {
  grid-row: 2;
}

#overlay-board .over-invite,
#over-split .over-invite {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  align-self: end;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
}

.game-overlay button:not(.text-link):not(.ghost),
.ghost {
  border: 3px solid #101010;
  border-radius: 8px;
  padding: 10px 20px;
  background: var(--southgate);
  color: #ffffff;
  font: inherit;
  font-weight: 400;
  font-size: 1.25rem;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 0 #101010;
}

.game-overlay button.nudge-btn:not(.ghost) {
  width: 2.15rem;
  height: 2.15rem;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  text-shadow: none;
  box-shadow: 0 3px 0 #101010;
}

.game-overlay button.again-solo:not(.ghost) {
  width: 12.5rem;
  max-width: 100%;
}

.game-overlay .score-card > button.again-solo:not(.ghost) {
  width: 100%;
  max-width: none;
}

.game-overlay button.invite-btn:not(.ghost),
.game-overlay button.again-solo:not(.ghost),
.game-overlay button.again-under-invite:not(.ghost),
.game-overlay #score-form button[type="submit"] {
  box-sizing: border-box;
  padding: 12px 14px;
  font-family: inherit;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-shadow: none;
}

.game-overlay button.again-under-invite:not(.ghost) {
  width: 100%;
  white-space: nowrap;
}

.game-overlay button:not(.text-link):not(.ghost):hover,
.ghost:hover,
.cta-mini:hover,
.text-link:hover { filter: brightness(1.08); }

button.text-link {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--southgate-soft);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 400;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ghost {
  background: var(--southgate-deep);
  color: #ffffff;
  border: 3px solid #101010;
  box-shadow: 0 4px 0 #101010;
  font-size: 1.25rem;
  font-weight: 400;
}

.cta-mini {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  text-decoration: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.start-actions {
  gap: 10px;
  margin-top: 4px;
}

.prizes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 36rem;
}

.prize-announce,
.prize-line {
  margin: 0;
  color: var(--southgate);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.25;
}

.prize-announce {
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.prize-line {
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
}

.email-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.3;
}

.email-row[hidden] { display: none; }

.email-row input {
  width: 100%;
  height: 3.1875rem;
  padding: 0 8px;
  border-radius: 6px;
  border: 3px solid #101010;
  background: rgba(8, 40, 52, 0.9);
  color: #ffffff;
  font: inherit;
  font-size: 1rem;
  text-align: center;
}

.email-row input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 1px;
}

.initials-label {
  margin: 0;
  max-width: 16rem;
  font-size: 1.05rem;
  line-height: 1.3;
}

#score-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.initials-row {
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: stretch;
  gap: 6px;
  width: 100%;
}

.initials-row .initial-box {
  flex: 1 1 0;
  width: auto;
  height: auto;
  min-width: 0;
}

.initials-row button[type="submit"] {
  position: relative;
  flex: 0 0 auto;
}

.initials-row button[type="submit"]:disabled {
  opacity: 1;
}

.initials-row .save-wait {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.initials-row button.is-saving .save-label {
  visibility: hidden;
}

.initials-row button.is-saving .save-wait {
  display: flex;
}

.initials-row .save-wait i {
  width: 4px;
  height: 4px;
  background: #ffffff;
  animation: save-dot 0.9s infinite;
}

.initials-row .save-wait i:nth-child(2) { animation-delay: 0.15s; }
.initials-row .save-wait i:nth-child(3) { animation-delay: 0.3s; }

@keyframes save-dot {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .initials-row .save-wait i { animation: none; opacity: 1; }
}

.initial-box {
  width: 2.6rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 6px;
  border: 3px solid #101010;
  background: rgba(8, 40, 52, 0.9);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.initial-box:focus {
  outline: 2px solid rgba(0, 153, 205, 0.55);
  outline-offset: 1px;
}

.note { margin: 0; color: var(--muted); font-size: 1rem; }

.board {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 0;
}

.board th,
.board td {
  text-align: left;
  padding: 5px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.05rem;
}

.board th { color: var(--southgate-soft); font-weight: 400; font-size: 0.95rem; letter-spacing: 0.04em; }

.board td:nth-child(2) {
  font-weight: 400;
  letter-spacing: 0.12em;
}

.error { color: #ffb4b4; }
