/* Nefaricorp Training Center: the retro arcade section of the site. Loaded only
   on /training/ pages. Builds on the tokens and bands in main.css. */

@font-face {
  font-family: 'Press Start 2P';
  src: url('../assets/fonts/PressStart2P-400.woff2?v=05d166028c') format('woff2');
  font-display: swap;
}

:root {
  --tc-pixel: 'Press Start 2P', var(--font-mono);
}

[hidden] {
  display: none !important;
}

/* Hub hero */
.tc-hub-hero {
  padding: 0;
  overflow: hidden;
  background-color: var(--night);
  background-image:
    linear-gradient(var(--color-border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border-light) 1px, transparent 1px);
  background-size: 28px 28px;
}

.tc-hub-hero .container {
  padding-block: clamp(0.9rem, 2.5vw, 1.75rem) 0.5rem;
}

.tc-sign {
  display: inline-grid;
  gap: 0.55em;
  margin: 0 0 0.9rem;
  padding: 0.6em 0.8em;
  background-color: var(--ink);
  border: 3px solid var(--cap);
  box-shadow: 5px 5px 0 var(--sauce);
  font-family: var(--tc-pixel);
  font-size: clamp(0.56rem, 1.5vw, 0.8rem);
  line-height: 1.15;
  text-transform: uppercase;
}

.tc-sign span:first-child {
  color: var(--cap);
}

.tc-sign span:last-child {
  color: var(--white);
}

.tc-hub-hero h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(2.5rem, 6.5vw, 4.25rem);
}

.tc-hub-lede {
  margin: 0;
  color: var(--white);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-weight: var(--font-weight-semibold);
}

.tc-hub-band {
  overflow: hidden;
}

.tc-hub-drip {
  background: linear-gradient(var(--blue) 0 22%, var(--ink) 22%);
}

/* The training floor */
.tc-floor {
  padding-block: 0.75rem clamp(2rem, 5vw, 3.5rem);
  background-color: var(--night);
}

.tc-filter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tc-filter button {
  flex: 1 1 0;
  max-width: 14rem;
  min-height: 44px;
  background: transparent;
  border: 2px solid var(--steel);
  color: var(--white);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
}

.tc-filter button[aria-pressed='true'] {
  background-color: var(--cap);
  border-color: var(--cap);
  color: var(--ink);
}

.tc-continue {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  max-width: 34rem;
  margin-bottom: 0.9rem;
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  background-color: var(--ink);
  border: 2px solid var(--steel);
  color: var(--white);
  text-decoration: none;
}

.tc-continue:hover,
.tc-continue:focus-visible {
  border-color: var(--cap);
  color: var(--white);
}

.tc-continue[hidden] {
  display: none;
}

.tc-continue img {
  display: block;
  width: 4rem;
  height: 3rem;
  object-fit: cover;
  image-rendering: pixelated;
}

.tc-continue b,
.tc-continue small {
  display: block;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-continue small {
  color: var(--mist);
}

.tc-card-play {
  color: var(--cap);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  text-transform: uppercase;
}

.tc-cabinets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tc-card,
.tc-leader {
  --tc-accent: var(--sauce);
  --tc-accent-ink: var(--white);
}

.tc-card--blue {
  --tc-accent: var(--blue);
}

.tc-card--cap {
  --tc-accent: var(--cap);
  --tc-accent-ink: var(--ink);
}

.tc-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--night);
  border: 3px solid var(--white);
  box-shadow: 8px 8px 0 var(--tc-accent);
  color: var(--white);
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

.tc-card a:hover,
.tc-card a:focus-visible {
  color: var(--white);
  transform: translate(-3px, -3px);
  box-shadow: 11px 11px 0 var(--tc-accent);
}

.tc-card-marquee {
  padding: 0.85em 0.6em;
  background-color: var(--tc-accent);
  color: var(--tc-accent-ink);
  font-family: var(--tc-pixel);
  font-size: clamp(0.72rem, 1.25vw, 0.95rem);
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
}

.tc-card-screen {
  position: relative;
  display: block;
  margin: 0.75rem 0.75rem 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--ink);
  border: 3px solid var(--steel);
}

.tc-card-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
  image-rendering: pixelated;
}

.tc-card[data-slug='sauce-breach'] img { object-position: 50% 20%; }
.tc-card[data-slug='unit-recall'] img { object-position: 50% 55%; }
.tc-card[data-slug='head-launch'] img { object-position: 50% 100%; }
.tc-card[data-slug='quality-control'] img { object-position: 50% 45%; }
.tc-card[data-slug='sauce-stacker'] img { object-position: 50% 85%; }

.tc-card-screen::after,
.tc-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, 0.16) 2px 4px);
}

.tc-card-lock {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: max-content;
  max-width: 90%;
  padding: 0.5em 0.7em;
  background-color: var(--cap);
  color: var(--ink);
  font-family: var(--tc-pixel);
  font-size: 0.6rem;
  line-height: 1.4;
  text-align: center;
  transform: translate(-50%, -50%) rotate(-4deg);
}

.tc-card-deck {
  display: grid;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem 0.7rem;
}

.tc-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Party cards use the space for their invite. */
[data-filter-list='two-players'] .tc-card-meta .label {
  display: none;
}

[data-filter-list='two-players'] .tc-card-play {
  width: 100%;
  text-align: center;
}

.tc-card-deck .label {
  color: var(--mist);
}

.tc-card-tag {
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

.tc-card-deck .tc-card-top {
  color: var(--cap);
}

/* Global leaderboards on the hub */
.tc-leaders {
  background-color: var(--night);
}

.tc-leaders h2 {
  margin: 0.6rem 0 0.75rem;
}

.tc-leaders-lede {
  max-width: 62ch;
  font-size: 1.1rem;
}

.tc-leaders-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.tc-leader {
  display: flex;
  flex-direction: column;
  background-color: var(--ink);
  border: 2px solid var(--tc-accent);
}

.tc-leader-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  background-color: var(--tc-accent);
  color: var(--tc-accent-ink);
  font-family: var(--tc-pixel);
  font-size: 0.62rem;
  line-height: 1.4;
  text-decoration: none;
  text-transform: uppercase;
}

.tc-leader-head:hover,
.tc-leader-head:focus-visible {
  color: var(--tc-accent-ink);
  text-decoration: underline;
}

.tc-leader-screen {
  position: relative;
  flex: 1;
  padding: 0.9rem 0.75rem 0.5rem;
  overflow: hidden;
  background-color: #03060a;
  background-image:
    linear-gradient(rgba(93, 180, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 180, 255, 0.07) 1px, transparent 1px);
  background-size: 18px 18px;
}

.tc-leader-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, 0.18) 2px 4px);
}

.tc-leader-note {
  margin: 0;
  padding-block: 7rem;
  color: var(--mist);
  text-align: center;
}

.tc-avatar {
  display: block;
  image-rendering: pixelated;
}

/* Winners' podium: second, first, third from left to right */
.tc-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tc-step {
  --medal: var(--mist);
  display: grid;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.tc-step-1 {
  --medal: var(--cap);
  order: 2;
}

.tc-step-2 {
  order: 1;
}

.tc-step-3 {
  --medal: #d98a4b;
  order: 3;
}

.tc-step-figure .tc-avatar {
  width: 48px;
  height: auto;
}

.tc-step-1 .tc-step-figure .tc-avatar {
  width: 60px;
  animation: tcWinner 1.1s steps(2) infinite;
}

@keyframes tcWinner {
  50% { transform: translateY(-3px); }
}

.tc-step-block {
  display: grid;
  place-items: center;
  width: 100%;
  margin-top: 2px;
  background-color: var(--medal);
  color: var(--ink);
  font-family: var(--tc-pixel);
  font-size: 0.85rem;
  line-height: 1;
}

.tc-step-1 .tc-step-block {
  height: 48px;
  font-size: 1.15rem;
}

.tc-step-2 .tc-step-block {
  height: 32px;
}

.tc-step-3 .tc-step-block {
  height: 20px;
}

/* Caption heights match across steps because the grid aligns to the bottom. */
.tc-step-name {
  width: 100%;
  margin-top: 0.4rem;
  overflow: hidden;
  color: var(--white);
  font-size: 0.86rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-step-score {
  color: var(--medal);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tc-step.is-open {
  --medal: var(--steel);
}

.tc-step.is-open .tc-avatar,
.tc-board li.is-open .tc-avatar {
  opacity: 0.35;
}

.tc-step.is-open .tc-step-name {
  color: var(--color-text-muted);
  font-weight: 400;
}

.tc-step.is-open .tc-step-block {
  color: var(--mist);
}

.tc-podium-rest {
  margin-top: 0.7rem;
  padding-top: 0.5rem;
  border-top: 2px solid var(--steel);
}

/* Most wanted posters */
.tc-wanted-lede {
  max-width: 62ch;
  font-size: 1.1rem;
}

.tc-wanted .label {
  margin-bottom: 0.75rem;
}

.tc-posters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.tc-poster {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.45rem;
  padding: 0.85rem 0.7rem 1rem;
  background-color: #f6e7c1;
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--ink);
  text-align: center;
}

.tc-poster:nth-child(odd) {
  transform: rotate(-1.4deg);
}

.tc-poster:nth-child(even) {
  transform: rotate(1.2deg);
}

.tc-poster-head {
  font-family: var(--tc-pixel);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.tc-poster img {
  width: 96px;
  height: 128px;
  image-rendering: pixelated;
}

.tc-poster b {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  line-height: 1;
  text-transform: uppercase;
}

.tc-poster-charge {
  font-size: 0.88rem;
  line-height: 1.3;
}

.tc-hub-promo h2 {
  max-width: 17ch;
}

.tc-hub-promo p {
  max-width: 62ch;
  font-size: 1.1rem;
}

/* Game page */
.tc-play {
  padding-block: 0.75rem clamp(2rem, 5vw, 4rem);
  background-color: var(--night);
}

.tc-play-grid {
  display: grid;
  grid-template-columns: minmax(0, 46rem) minmax(19rem, 1fr);
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: start;
}

.tc-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.tc-side-box {
  padding: 1rem;
  background-color: var(--ink);
  border: 2px solid var(--color-border);
}

.tc-side-box h2 {
  margin-bottom: 0.65rem;
}

.tc-side-box p {
  margin: 0;
  font-size: 0.95rem;
}

.tc-side-promo {
  display: grid;
  gap: 0.6rem;
}

.tc-side-next {
  display: grid;
  gap: 0.7rem;
}

.tc-side-next h2 {
  margin: 0;
}

.tc-kicker {
  margin: 0;
  color: var(--cap);
  font-family: var(--tc-pixel);
  font-size: 0.62rem;
  font-weight: normal;
  line-height: 1.5;
  text-transform: uppercase;
}

/* Scoreboard */
.tc-board {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tc-board li {
  display: grid;
  grid-template-columns: 2.1em 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5em;
  padding: 0.15rem 0.3rem;
  color: var(--white);
}

.tc-board li .tc-avatar {
  width: 18px;
  height: 24px;
}

.tc-board .tc-rank {
  color: var(--color-text-muted);
}

.tc-board .tc-rank-1 .tc-rank,
.tc-board .tc-rank-1 span:last-child {
  color: var(--cap);
}

.tc-board .tc-rank-2 .tc-rank,
.tc-board .tc-rank-2 span:last-child {
  color: var(--mist);
}

.tc-board .tc-rank-3 .tc-rank,
.tc-board .tc-rank-3 span:last-child {
  color: #d98a4b;
}

.tc-board li.is-open b,
.tc-board li.is-open span:last-child {
  color: var(--color-text-muted);
  font-weight: 400;
}

.tc-board li b {
  overflow: hidden;
  font-family: var(--font-primary);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-board li span:last-child {
  text-align: right;
}

.tc-board li.is-you {
  background-color: var(--cap);
  color: var(--ink);
}

.tc-board li.is-you .tc-rank,
.tc-board li.is-you span:last-child {
  color: var(--ink);
}

.tc-board .tc-board-empty {
  display: block;
  color: var(--mist);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: var(--font-weight-regular);
}

/* The cabinet */
.tc-cab {
  --tc-accent: var(--sauce);
  --tc-accent-ink: var(--white);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--ink);
  border: 3px solid var(--white);
  box-shadow: 10px 10px 0 var(--tc-accent);
  scroll-margin-top: 6rem;
}

.tc-cab--blue {
  --tc-accent: var(--blue);
}

.tc-cab--cap {
  --tc-accent: var(--cap);
  --tc-accent-ink: var(--ink);
}

.tc-marquee {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background-color: var(--tc-accent);
  color: var(--tc-accent-ink);
}

.tc-marquee-title {
  order: 1;
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: inherit;
  font-family: var(--tc-pixel);
  font-size: clamp(0.6rem, 1.4vw, 0.85rem);
  font-weight: normal;
  letter-spacing: 0;
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tc-mini {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0.2rem 0.6rem;
  background-color: var(--ink);
  border: 0;
  color: var(--white);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
}

.tc-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  order: 0;
  color: var(--white);
  text-decoration: none;
}

.tc-back:hover,
.tc-back:focus-visible {
  color: var(--cap);
}

.tc-mute {
  order: 2;
}

.tc-pause {
  display: none;
  order: 2;
}

/* During a run Mute moves to the far side, away from Pause. */
.tc-cab.is-running .tc-back {
  display: none;
}

.tc-cab.is-running .tc-mute {
  order: 0;
}

.tc-cab.is-running .tc-pause {
  display: block;
}

.tc-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: min(calc(100dvh - 10rem), 700px);
  min-height: 480px;
  overflow: hidden;
  background-color: #03060a;
}

.tc-screen {
  position: relative;
  aspect-ratio: var(--tc-ratio, 3 / 4);
  max-width: 100%;
  max-height: 100%;
}

.tc-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  outline: none;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Head Launch takes drags from the whole screen, including the black bars. */
.tc-cab[data-game='head-launch'].is-running .tc-stage,
.tc-cab[data-game='clone-and-seek'].is-running .tc-stage,
.tc-cab[data-game='clone-and-seek-versus'].is-playing .tc-stage {
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Panels sit over the screen */
.tc-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: #03060a;
  text-align: center;
}

.tc-panel > :first-child {
  margin-top: auto;
}

.tc-panel > :last-child {
  margin-bottom: auto;
}

.tc-panel p {
  margin: 0;
}

.tc-panel-title {
  color: var(--white);
  font-family: var(--font-heading);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 900;
  line-height: 0.92;
  text-transform: uppercase;
  text-wrap: balance;
}

.tc-how {
  display: grid;
  gap: 0.4rem;
  max-width: 30rem;
  margin: 0.25rem 0 0.5rem;
  padding: 0;
  list-style: none;
  color: var(--white);
  font-size: 0.98rem;
  line-height: 1.35;
}

.tc-start-actions,
.tc-pause-actions {
  display: grid;
  gap: 0.55rem;
  width: min(100%, 20rem);
}

.tc-panel .tc-pause-note {
  color: var(--mist);
  font-size: 0.85rem;
}

.tc-how-more {
  width: min(100%, 30rem);
}

.tc-how-more summary {
  padding: 0.5rem;
  color: var(--cap);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.tc-panel .tc-controls {
  max-width: 30rem;
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.4;
}

.tc-controls-touch {
  display: none;
}

@media (pointer: coarse) {
  .tc-controls-touch {
    display: block;
  }

  .tc-controls-keys {
    display: none;
  }
}

.tc-panel .tc-lock-note {
  margin-bottom: 0.6rem;
  color: var(--cap);
  font-weight: var(--font-weight-semibold);
}

.tc-score {
  color: var(--cap);
  font-family: var(--tc-pixel);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  line-height: 1.2;
}

.tc-panel .tc-best {
  color: var(--white);
}

.tc-panel .tc-over-rank {
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.3;
}

.tc-panel .tc-over-rank:empty,
.tc-panel .tc-detail:empty {
  display: none;
}

/* Results: everything scrolls except the buttons, which stay under the thumb. */
.tc-panel.tc-panel-over {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.tc-panel.tc-panel-over > :first-child,
.tc-panel.tc-panel-over > :last-child {
  margin-block: 0;
}

.tc-over-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 0;
  padding: 0.85rem clamp(0.75rem, 3vw, 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tc-over-scroll .tc-panel-title {
  font-size: clamp(2rem, 6vw, 3rem);
}

.tc-dock {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  width: 100%;
  padding: 0.6rem clamp(0.6rem, 3vw, 1.25rem) 0.7rem;
  background-color: var(--ink);
  border-top: 3px solid var(--tc-accent);
}

.tc-dock .btn {
  width: 100%;
}

.tc-dock-row {
  display: flex;
  gap: 0.45rem;
  min-width: 0;
}

.tc-dock-row .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-dock-row .btn[data-next] {
  flex-grow: 1.7;
}

@media (max-width: 380px) {
  .tc-dock-row .btn {
    font-size: 0.95rem;
  }
}

/* A compact row in the results: filing, second chance, or Tubi. */
.tc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: min(100%, 28rem);
  min-height: 44px;
  flex: none;
  padding: 0.4rem 0.6rem;
  background-color: var(--ink);
  border: 0;
  color: var(--white);
  font-family: var(--font-primary);
  font-size: 0.88rem;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
}

.tc-row:is(a, button) {
  cursor: pointer;
}

.tc-row:is(a, button):hover,
.tc-row:is(a, button):focus-visible {
  color: var(--white);
  outline: 2px solid var(--cap);
}

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

.tc-row-act {
  flex: none;
  padding: 0.3rem 0;
  background: none;
  border: 0;
  color: var(--cap);
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  text-transform: uppercase;
}

.tc-row--tubi .tc-row-act {
  padding: 0.45rem 0.55rem;
  background-color: var(--sauce);
  color: var(--white);
}

.tc-text-link {
  padding: 0.5rem;
  color: var(--cap);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.tc-panel-wait {
  gap: 0.5rem;
}

.tc-qr {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  margin: 0;
}

.tc-qr[hidden] {
  display: none;
}

.tc-qr canvas {
  display: block;
  width: min(44vw, 11rem);
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.tc-qr figcaption {
  color: var(--mist);
  font-size: 0.82rem;
}

/* The game picker */
.tc-picker {
  width: min(100vw, 44rem);
  max-width: 100vw;
  max-height: 100dvh;
  margin: auto auto 0;
  padding: 0 0.9rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  background-color: var(--ink);
  border: 0;
  border-top: 4px solid var(--cap);
  color: var(--white);
}

.tc-picker::backdrop {
  background-color: rgba(3, 6, 10, 0.85);
}

.tc-picker-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.6rem;
  background-color: var(--ink);
}

.tc-picker-head .tc-panel-title {
  margin: 0;
  font-size: 2rem;
}

.tc-picker-all {
  display: block;
  margin-top: 1rem;
  text-align: center;
}

.tc-panel .tc-detail {
  max-width: 30rem;
  color: var(--mist);
  font-size: 0.95rem;
  line-height: 1.35;
}

.tc-name-form {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  width: 100%;
  padding-block: 0.25rem;
}

.tc-name-form label {
  color: var(--white);
}

.tc-name-row {
  justify-content: center;
}

.tc-name-form input {
  flex: 1 1 10rem;
  width: 10rem;
  max-width: 100%;
  min-height: 48px;
  padding: 0 0.7rem;
  background-color: var(--ink);
  border: 2px solid var(--cap);
  color: var(--white);
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 700;
}

.tc-name-form input::placeholder {
  color: var(--color-text-muted);
  font-weight: 400;
}

.tc-panel .tc-name-hint {
  max-width: 24rem;
  color: var(--mist);
  font-size: 0.8rem;
  line-height: 1.3;
}

.tc-panel .tc-form-msg {
  min-height: 1.2em;
  color: var(--mist);
  font-size: 0.88rem;
  line-height: 1.3;
}

.tc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.tc-board-wrap {
  display: grid;
  gap: 0.5rem;
  width: min(100%, 20rem);
  padding-top: 0.5rem;
}

.tc-board-wrap .tc-board {
  text-align: left;
}

/* Party results still carry the full Tubi and mobile game buttons. */
.tc-promo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  width: min(100%, 26rem);
  padding: 0.9rem;
  border: 2px solid var(--cap);
}

.tc-promo p {
  flex-basis: 100%;
  color: var(--white);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

/* Thumb joystick for drag-to-walk games */
.tc-stick {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tc-stick[hidden] {
  display: none;
}

.tc-stick::before {
  content: '';
  position: absolute;
  left: -30px;
  top: -30px;
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.tc-stick-knob {
  position: absolute;
  left: -15px;
  top: -15px;
  width: 30px;
  height: 30px;
  background-color: rgba(255, 217, 59, 0.85);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

/* Two-player onboarding */
.tc-onboard {
  display: grid;
  gap: 0.7rem;
  width: min(100%, 26rem);
  margin: 0;
  font-size: 0.95rem;
  padding: 0;
  list-style: none;
  text-align: left;
}

.tc-onboard li {
  display: grid;
  grid-template-columns: 4.75rem 1fr;
  align-items: center;
  gap: 0.75rem;
  line-height: 1.3;
}

.tc-onboard b {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--cap);
}

.tc-onboard-icons {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.2rem;
  min-height: 3rem;
  padding: 0.3rem;
  background-color: var(--floor, #0d1721);
  border: 2px solid var(--steel);
}

.tc-onboard-icons canvas {
  width: auto;
  height: 2.2rem;
  image-rendering: pixelated;
}

/* The button stays in reach when the rules have to scroll on a small phone. */
.tc-panel [data-versus-got-it] {
  position: sticky;
  bottom: 0;
  flex: none;
  box-shadow: 0 0 0 0.5rem rgba(3, 6, 10, 0.97);
}

@media (max-height: 760px) {
  [data-panel='onboard'] .tc-panel-title {
    display: none;
  }

  [data-panel='onboard'] {
    gap: 0.5rem;
    padding-block: 0.6rem;
  }
}

.tc-onboard-again {
  padding: 0.5rem;
  background: none;
  border: 0;
  color: var(--cap);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: underline;
  text-transform: uppercase;
}

/* Party game badge, for games with a two-player mode */
.tc-party-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 0.65em 0.45em;
  background-color: var(--cap);
  box-shadow: 5px 5px 0 var(--sauce);
  color: var(--ink);
  font-family: var(--tc-pixel);
  font-size: clamp(0.8rem, 1.15vw, 0.95rem);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(3deg);
}

.tc-party-badge svg {
  display: block;
  width: 1.6em;
  height: 1.1em;
  shape-rendering: crispEdges;
}

.tc-more-list .tc-party-badge {
  position: static;
  font-size: 0.7rem;
  align-self: flex-start;
  margin-bottom: 0.4rem;
  transform: none;
}

/* Ad break and rewarded video */
.tc-ad {
  width: min(100vw, 60rem);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(0.75rem, env(safe-area-inset-bottom));
  border: 0;
  background-color: transparent;
  color: var(--white);
}

.tc-ad:focus {
  outline: none;
}

.tc-ad[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.tc-ad::backdrop {
  background-color: rgb(3, 6, 10);
}

.tc-ad-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
}

.tc-ad-kicker {
  margin: 0;
  color: var(--cap);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tc-ad-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.tc-ad-media iframe {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.tc-ad-media video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000;
}

.tc-ad-bottom {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  text-align: center;
}

.tc-ad-status {
  margin: 0;
  min-height: 2.6em;
  line-height: 1.3;
}

.tc-ad-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.tc-ad-actions .btn:disabled {
  cursor: default;
  opacity: 0.6;
}

/* Coming soon cabinets */
.tc-soon {
  margin-top: 3rem;
}

.tc-card--soon .tc-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--night);
  border: 3px solid var(--steel, #44596b);
  box-shadow: 8px 8px 0 var(--tc-accent);
  color: var(--white);
}

.tc-card--soon .tc-card-screen img {
  filter: saturate(0.55) brightness(0.65);
}

.tc-card .tc-soon-preview,
.tc-card .tc-soon-preview:hover,
.tc-card .tc-soon-preview:focus-visible {
  display: inline-block;
  height: auto;
  margin-top: 0.4rem;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--cap);
  text-decoration: underline;
  transform: none;
}

.tc-card .tc-soon-preview[hidden] {
  display: none;
}

/* Sauce Breach Race: the live scoreboard above the game */
.tc-race-bar {
  display: grid;
  gap: 0.2rem;
  padding: 0.35rem 0.6rem 0.45rem;
  background-color: var(--night, #0b1c2c);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.25;
}

.tc-race-bar[hidden] {
  display: none;
}

.tc-race-scores {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 0.5rem;
}

.tc-race-side b {
  display: block;
  overflow: hidden;
  color: var(--dim, #7f97a8);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-race-side span {
  font-family: var(--tc-pixel);
  font-size: 0.8rem;
}

.tc-race-side--rival {
  text-align: right;
}

.tc-race-clock {
  color: var(--cap);
  font-family: var(--tc-pixel);
  font-size: 0.95rem;
}

.tc-race-tug {
  height: 6px;
  background-color: var(--blue);
}

.tc-race-tug span {
  display: block;
  width: 50%;
  height: 100%;
  background-color: var(--sauce);
  transition: width 0.4s;
}

.tc-race-bar p {
  margin: 0;
}

.tc-race-rival {
  color: var(--dim, #7f97a8);
  text-align: right;
}

.tc-race-feed {
  min-height: 1.25em;
  color: var(--cap);
}

.tc-race-feed.is-new {
  animation: tc-race-flash 0.6s;
}

@keyframes tc-race-flash {
  from { color: var(--white); background-color: var(--sauce); }
  to { color: var(--cap); background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .tc-race-feed.is-new {
    animation: none;
  }

  .tc-race-tug span {
    transition: none;
  }
}

.tc-race-taunts {
  display: flex;
  gap: 0.3rem;
}

.tc-race-taunts .tc-mini {
  flex: 1;
  min-height: 30px;
  padding: 0.1rem 0.2rem;
  background-color: var(--ink);
  font-size: 0.62rem;
}

.tc-race-count {
  justify-content: center;
}

.tc-race-final {
  font-family: var(--font-mono);
}

.tc-versus-code {
  color: var(--cap);
  font-family: var(--tc-pixel);
  font-size: clamp(2rem, 11vw, 3.25rem);
  letter-spacing: 0.08em;
}

.tc-panel.tc-versus-over {
  inset: auto 0 1rem;
  background-color: transparent;
  overflow: visible;
}

/* AdSense display units, kept clear of the game controls */
.tc-ad-slot {
  min-height: 120px;
  margin-block: 2rem;
}

.tc-ad-slot[hidden],
.tc-ad-slot:has(ins[data-ad-status='unfilled']) {
  display: none;
}

.tc-ad-slot-label {
  display: none;
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.7;
}

.tc-ad-slot:has(ins[data-ad-status='filled']) .tc-ad-slot-label {
  display: block;
}

@media (max-width: 720px) {
  .tc-ad-slot {
    min-height: 250px;
  }
}

/* More modules */
.tc-more-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tc-more-list a {
  display: grid;
  align-content: start;
  gap: 0.25rem;
  height: 100%;
  padding: 0.85rem;
  background-color: var(--white);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  font-weight: var(--font-weight-regular);
  line-height: 1.3;
  text-decoration: none;
  transition: transform 0.12s;
}

.tc-more-list a:hover,
.tc-more-list a:focus-visible {
  color: var(--ink);
  transform: translate(-2px, -2px);
}

.tc-more-list b {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  line-height: 1;
  text-transform: uppercase;
}

/* Compact cards: the picker, Up Next and the phone hub. */
.tc-cabinets--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.85rem;
  padding-right: 6px;
}

.tc-cabinets--compact .tc-card a {
  border-width: 2px;
  box-shadow: 5px 5px 0 var(--tc-accent);
}

.tc-cabinets--compact .tc-card-marquee {
  display: grid;
  min-height: 2.9em;
  place-items: center;
  padding: 0.5em 0.3em;
  font-size: 0.56rem;
}

.tc-cabinets--compact .tc-card-screen {
  margin: 0.4rem 0.4rem 0;
  border-width: 2px;
}

.tc-cabinets--compact .tc-card-deck {
  padding: 0.35rem 0.5rem 0.45rem;
}

.tc-cabinets--compact .tc-card-deck .label {
  font-size: 0.68rem;
}

.tc-cabinets--compact .tc-party-badge {
  top: 0.25rem;
  right: 0.2rem;
  padding: 0.4em 0.45em 0.35em;
  box-shadow: 3px 3px 0 var(--sauce);
  font-size: 0.5rem;
}

/* A desktop sidebar already shows the board, and results buttons fit in one row. */
@media (min-width: 961px) and (min-height: 621px) {
  .tc-board-wrap,
  .tc-panel-over .tc-text-link {
    display: none;
  }

  .tc-dock {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    align-items: stretch;
  }
}

/* While playing on a phone or a short window, the cabinet fills the screen. */
@media (max-width: 960px), (max-height: 620px) {
  html.tc-locked,
  html.tc-locked body {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .tc-cab.is-playing {
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border: 0;
    box-shadow: none;
  }

  .tc-cab.is-playing .tc-stage {
    flex: 1;
    height: auto;
    min-height: 0;
  }
}

/* A phone held sideways: a slim title bar leaves the height to the game. */
@media (max-height: 500px) and (orientation: landscape) {
  .tc-cab.is-playing .tc-marquee {
    padding: 0.15rem max(0.6rem, env(safe-area-inset-right, 0px)) 0.15rem max(0.6rem, env(safe-area-inset-left, 0px));
  }

  .tc-cab.is-playing .tc-mini {
    min-height: 32px;
  }
}

@media (max-width: 960px) {
  .tc-play-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tc-stage {
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 5;
    max-height: 80dvh;
  }

  .tc-cab {
    margin-right: 10px;
  }

  .tc-cab.is-playing {
    margin-right: 0;
  }

  .tc-cab.is-playing .tc-stage {
    aspect-ratio: auto;
    max-height: none;
  }

  .tc-more-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tc-cabinets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Up Next comes straight after the cabinet, ahead of the scores. */
  .tc-side-next {
    order: -1;
  }

  .tc-posters,
  .tc-leaders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .tc-leaders-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Two cabinets per row on a phone, so the games show without scrolling. */
  .tc-cabinets {
    gap: 0.75rem 0.85rem;
    padding-right: 6px;
  }

  .tc-card a {
    border-width: 2px;
    box-shadow: 5px 5px 0 var(--tc-accent);
  }

  .tc-card-marquee {
    display: grid;
    min-height: 2.9em;
    place-items: center;
    padding: 0.5em 0.3em;
    font-size: 0.56rem;
  }

  .tc-card-screen {
    margin: 0.4rem 0.4rem 0;
    border-width: 2px;
  }

  .tc-card-deck {
    padding: 0.35rem 0.5rem 0.45rem;
  }

  .tc-card-deck .label {
    font-size: 0.68rem;
  }

  .tc-card-tag,
  .tc-card-deck .tc-card-top {
    display: none;
  }

  .tc-card .tc-party-badge {
    top: 0.25rem;
    right: 0.2rem;
    padding: 0.4em 0.45em 0.35em;
    box-shadow: 3px 3px 0 var(--sauce);
    font-size: 0.5rem;
  }

  .tc-stage {
    aspect-ratio: 3 / 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tc-step-1 .tc-step-figure .tc-avatar {
    animation: none;
  }

  .tc-card a,
  .tc-more-list a {
    transition: none;
  }
}
