/* ============================================================
   MLSysBook Playground — shared styles
   One palette, one typography scale, reused by every game.
   ============================================================ */

:root {
  --mlsp-blue:          #cfe2f3;
  --mlsp-blue-stroke:   #4a90c4;
  --mlsp-green:         #d4edda;
  --mlsp-green-stroke:  #3d9e5a;
  --mlsp-red:           #f9d6d5;
  --mlsp-red-stroke:    #c44;
  --mlsp-orange:        #fdebd0;
  --mlsp-orange-stroke: #c87b2a;
  --mlsp-mit-red:       #a31f34;
  --mlsp-text:          #333;
  --mlsp-muted:         #777;
  --mlsp-faint:         #bbb;
  --mlsp-border:        #e0e0e0;
  --mlsp-bg-soft:       #f7f7f7;
  --mlsp-ink:           #101827;
  --mlsp-panel:         #ffffff;
}

/* Put a one-sentence instruction where readers see it before the canvas. */
main:has(.mlsp-game-container) .quarto-title-block .description {
  border-left: 3px solid var(--mlsp-mit-red);
  border-radius: 0 7px 7px 0;
  background: var(--mlsp-bg-soft);
  padding: 0.6rem 0.8rem;
  line-height: 1.45;
}
main:has(.mlsp-game-container) .quarto-title-block .description::before {
  content: "First move";
  display: block;
  margin-bottom: 0.2rem;
  color: var(--mlsp-mit-red);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mlsp-game-container {
  position: relative;
  margin: 1.75rem auto;
  max-width: 720px;
  border: 1px solid var(--mlsp-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  box-shadow: 0 8px 22px rgba(0,0,0,0.06);
}
.mlsp-game-container::before {
  content: none;
}

.mlsp-game-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  background: #fafafa;
  touch-action: manipulation;
  cursor: default;
}

.mlsp-game-hud {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.62rem 0.9rem;
  background: #fff;
  border-top: 1px solid var(--mlsp-border);
  font-size: 0.85rem;
  color: var(--mlsp-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mlsp-score {
  font-weight: 600;
  color: var(--mlsp-text);
  font-variant-numeric: tabular-nums;
}

.mlsp-game-hud kbd {
  background: var(--mlsp-bg-soft);
  border: 1px solid var(--mlsp-faint);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--mlsp-text);
}

main kbd {
  display: inline-block;
  min-width: 1.15em;
  padding: 0.05rem 0.24rem;
  border: 1px solid var(--mlsp-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--mlsp-bg-soft);
  color: var(--mlsp-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78em;
  line-height: 1.15;
  text-align: center;
  vertical-align: 0.08em;
}

.mlsp-controls-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--mlsp-muted);
}
.mlsp-controls-line kbd {
  margin: 0 0.05rem;
}

/* Screen-reader-only — keeps live VRAM/speed announcements available to AT */
/* without duplicating the in-canvas HUD visually. */
.mlsp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mlsp-fullscreen-btn {
  background: #fff;
  border: 1px solid var(--mlsp-border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--mlsp-muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.48rem;
  margin-left: auto;
}
.mlsp-fullscreen-btn:hover {
  border-color: var(--mlsp-mit-red);
  color: var(--mlsp-mit-red);
}
.mlsp-retry-btn {
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--mlsp-border);
  border-radius: 6px;
  background: #fff;
  color: var(--mlsp-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.mlsp-retry-btn:hover,
.mlsp-retry-btn:focus-visible {
  border-color: var(--mlsp-mit-red);
  color: var(--mlsp-mit-red);
}

.mlsp-train-control {
  border: 1px solid #a31f34;
  border-radius: 6px;
  background: #a31f34;
  color: #fff;
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.mlsp-train-control:hover,
.mlsp-train-control:focus-visible {
  background: #861a2b;
  color: #fff;
}
.mlsp-train-control:active {
  transform: translateY(1px);
}
.mlsp-touch-controls {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem;
  border-top: 1px solid var(--mlsp-border);
  background: #fff;
}
.mlsp-touch-controls .mlsp-train-control {
  min-width: 3rem;
}
.mlsp-touch-controls .mlsp-steer-control {
  min-width: 5rem;
}

/* Fullscreen handling */
.mlsp-game-container:fullscreen {
  max-width: none;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  background: #111;
}
.mlsp-game-container:-webkit-full-screen {
  max-width: none;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  background: #111;
}
.mlsp-game-container:fullscreen .mlsp-game-canvas,
.mlsp-game-container:-webkit-full-screen .mlsp-game-canvas {
  flex: 1 1 auto;
  width: 100vw;
  height: calc(100vh - 58px);
  min-height: 0;
  object-fit: contain;
  background: #fafafa;
  margin: auto;
}
.mlsp-game-container:fullscreen .mlsp-game-hud,
.mlsp-game-container:-webkit-full-screen .mlsp-game-hud {
  flex-shrink: 0;
  min-height: 58px;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  font-size: clamp(0.86rem, 1.2vw, 1rem);
}

/* Aha card — shown after game-over to turn the loop into a mini-lesson */
.mlsp-aha-card {
  margin: 1rem auto;
  max-width: 720px;
  background: #fff;
  border: 1px solid var(--mlsp-border);
  border-left: 4px solid var(--mlsp-mit-red);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--mlsp-text);
  line-height: 1.55;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.mlsp-aha-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--mlsp-mit-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.4rem;
}
.mlsp-aha-card p {
  margin: 0;
}

/* Share row — appended below the aha message. Holds the emoji-grid result */
/* and a copy-to-clipboard button. Reused across all games via attachShareRow. */
.mlsp-share-row {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--mlsp-border);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.mlsp-share-text {
  margin: 0;
  flex: 1 1 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mlsp-text);
  background: var(--mlsp-bg-soft);
  border: 1px solid var(--mlsp-border);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  white-space: pre-wrap;
}
.mlsp-share-btn {
  border: 1px solid var(--mlsp-mit-red);
  background: #fff;
  color: var(--mlsp-mit-red);
  border-radius: 999px;
  padding: 0.42rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.mlsp-share-btn:hover {
  background: var(--mlsp-mit-red);
  color: #fff;
}

/* Four lightweight starting points before the full catalog. */
.mlsp-featured-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1rem 0 1.6rem;
}
.mlsp-featured-game {
  --feature-accent: #3978a6;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 12rem;
  gap: 0.55rem;
  padding: 0.95rem;
  border: 1px solid var(--mlsp-border);
  border-left: 4px solid var(--feature-accent);
  border-radius: 10px;
  background: #fff;
  color: var(--mlsp-text);
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.045);
}
.mlsp-featured-game:hover,
.mlsp-featured-game:focus-visible {
  border-color: var(--feature-accent);
  color: var(--mlsp-text);
  text-decoration: none;
  transform: translateY(-2px);
}
.mlsp-featured-game span {
  color: var(--feature-accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mlsp-featured-game strong {
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--mlsp-text);
}
.mlsp-featured-game:hover strong,
.mlsp-featured-game:focus-visible strong { color: var(--feature-accent); }
.mlsp-featured-game small {
  color: var(--mlsp-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.mlsp-featured-game b {
  margin-top: auto;
  color: var(--feature-accent);
  font-size: 0.82rem;
}
.mlsp-featured-game img {
  display: block;
  width: 100%;
  height: 8rem;
  object-fit: cover;
  border: 1px solid var(--mlsp-border);
  border-radius: 6px;
  margin-bottom: 0.15rem;
}
.mlsp-featured-v2 { --feature-accent: #a31f34; }
.mlsp-featured-v3 { --feature-accent: #715390; }
.mlsp-featured-v4 { --feature-accent: #267454; }
@media (max-width: 840px) {
  .mlsp-featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .mlsp-featured-grid { grid-template-columns: 1fr; }
  .mlsp-featured-game { min-height: 0; }
}

/* Volume map and gallery */
.mlsp-volume-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1.5rem 0 2.25rem;
}
.mlsp-volume-nav a {
  --mlsp-volume-accent: var(--mlsp-mit-red);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--mlsp-border);
  border-top: 4px solid var(--mlsp-volume-accent);
  border-radius: 9px;
  background: #fff;
  color: var(--mlsp-text);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.mlsp-volume-nav a:hover,
.mlsp-volume-nav a:focus-visible {
  border-color: var(--mlsp-volume-accent);
  color: var(--mlsp-text);
  text-decoration: none;
  transform: translateY(-2px);
}
.mlsp-volume-nav span {
  color: var(--mlsp-volume-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mlsp-volume-nav strong {
  font-size: 0.96rem;
  line-height: 1.2;
}
.mlsp-volume-nav small {
  color: var(--mlsp-muted);
  font-size: 0.78rem;
}
.mlsp-volume-nav .mlsp-volume-v1 { --mlsp-volume-accent: #3978a6; }
.mlsp-volume-nav .mlsp-volume-v2 { --mlsp-volume-accent: #a31f34; }
.mlsp-volume-nav .mlsp-volume-v3 { --mlsp-volume-accent: #715390; }
.mlsp-volume-nav .mlsp-volume-v4 { --mlsp-volume-accent: #267454; }
#volume-i, #volume-ii, #volume-iii, #volume-iv {
  scroll-margin-top: 5rem;
  margin-top: 2.6rem;
}
@media (max-width: 640px) {
  .mlsp-volume-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Playable cards */
.mlsp-game-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
  margin: 1.5rem 0;
}
.mlsp-game-card {
  border: 1px solid var(--mlsp-border);
  border-radius: 12px;
  padding: 1.25rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.mlsp-game-card:hover {
  border-color: rgba(163,31,52,0.35);
  box-shadow: 0 8px 22px rgba(0,0,0,0.07);
  transform: translateY(-2px);
}
.mlsp-game-card img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  display: block;
  border: 1px solid rgba(74,144,196,0.18);
  box-sizing: border-box;
}
.mlsp-game-card > a {
  text-decoration: none;
}
.mlsp-game-card .mlsp-card-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--mlsp-border);
  border-radius: 8px;
  margin-bottom: 0.85rem;
  background: var(--mlsp-bg-soft);
}
.mlsp-game-card .mlsp-card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
  margin: 0;
}
.mlsp-game-card .mlsp-card-preview:hover,
.mlsp-game-card .mlsp-card-preview:focus-visible {
  border-color: var(--mlsp-mit-red);
}
.mlsp-cover {
  min-height: 92px;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--mlsp-border);
  display: flex;
  align-items: center;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
  color: var(--mlsp-text);
  font-weight: 700;
  letter-spacing: 0.02em;
  background:
    linear-gradient(90deg, rgba(163,31,52,0.95) 0 4px, transparent 4px),
    linear-gradient(180deg, #fff, #f7f7f7);
  box-shadow: none;
}
.mlsp-cover::before {
  content: none;
}
.mlsp-cover-lander,
.mlsp-cover-pipeline,
.mlsp-cover-allreduce { background: linear-gradient(90deg, rgba(74,144,196,0.95) 0 4px, transparent 4px), linear-gradient(180deg, #fff, #f7f7f7); }
.mlsp-cover-oom,
.mlsp-cover-kvcache,
.mlsp-cover-cluster { background: linear-gradient(90deg, rgba(106,74,122,0.95) 0 4px, transparent 4px), linear-gradient(180deg, #fff, #f7f7f7); }
.mlsp-cover-prune,
.mlsp-cover-loader,
.mlsp-cover-batch { background: linear-gradient(90deg, rgba(61,158,90,0.95) 0 4px, transparent 4px), linear-gradient(180deg, #fff, #f7f7f7); }
.mlsp-cover-quantization,
.mlsp-cover-checkpoint,
.mlsp-cover-roofline,
.mlsp-cover-topology,
.mlsp-cover-moe { background: linear-gradient(90deg, rgba(163,31,52,0.95) 0 4px, transparent 4px), linear-gradient(180deg, #fff, #f7f7f7); }
.mlsp-game-card.mlsp-hero-card {
  grid-column: 1 / -1;
  flex-direction: row;
  gap: 1.5rem;
}
.mlsp-hero-img {
  flex: 1;
  min-width: 300px;
}
.mlsp-hero-img:empty {
  display: none;
}
.mlsp-hero-img img {
  margin-bottom: 0;
}
.mlsp-hero-body {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.mlsp-hero-body p:last-child {
  margin-bottom: 0;
}
.mlsp-game-card.mlsp-hero-card h3 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 768px) {
  .mlsp-game-card.mlsp-hero-card {
    flex-direction: column;
  }
  .mlsp-hero-img {
    width: 100%;
    min-width: unset;
  }
}
.mlsp-game-card h3 {
  margin: 0 0 0.35rem 0;
  font-size: 1.1rem;
  color: var(--mlsp-text);
}
.mlsp-card-meta {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--mlsp-border);
  font-size: 0.82rem;
  color: var(--mlsp-muted);
  line-height: 1.5;
}
.mlsp-meta-row {
  margin-bottom: 0.3rem;
}
.mlsp-meta-row strong {
  color: var(--mlsp-text);
  font-weight: 600;
}
.mlsp-meta-row a {
  color: var(--mlsp-mit-red);
  text-decoration: none;
}
.mlsp-meta-row a:hover {
  text-decoration: underline;
}
.mlsp-card-tagline {
  display: block;
  font-size: 0.85rem;
  color: var(--mlsp-muted);
  font-style: italic;
  margin: 0;
}
.mlsp-game-card p {
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
  flex-grow: 0;
  line-height: 1.5;
  color: var(--mlsp-text);
}
.mlsp-game-card > p:has(.mlsp-card-tagline) {
  margin-bottom: 0.75rem;
}
.mlsp-game-card > p:has(.mlsp-card-cta) {
  margin-top: auto;
  margin-bottom: 0;
}
.mlsp-game-card > p:not(:has(.mlsp-card-tagline)):not(:has(.mlsp-card-cta)):not(:has(.mlsp-card-preview)) {
  flex-grow: 1;
}
.mlsp-game-card > p:has(.mlsp-card-preview) {
  flex-grow: 0;
  margin-bottom: 0.85rem;
}
.mlsp-card-cta {
  background: var(--mlsp-mit-red);
  color: #fff !important;
  padding: 0.48rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  display: inline-block;
  transition: background 0.15s ease;
  box-shadow: none;
}
.mlsp-card-cta:hover {
  background: #821827;
}
#volume-iii .mlsp-game-card h3 { border-left-color: #715390; }
#volume-iii .mlsp-card-cta { background: #715390; }
#volume-iii .mlsp-card-cta:hover { background: #584074; }
#volume-iii .mlsp-game-card:hover { border-color: #bba8cf; }
#volume-iv .mlsp-game-card h3 { border-left-color: #267454; }
#volume-iv .mlsp-card-cta { background: #267454; }
#volume-iv .mlsp-card-cta:hover { background: #1d6045; }
#volume-iv .mlsp-game-card:hover { border-color: #9ac5aa; }
.mlsp-game-card.mlsp-coming-soon {
  opacity: 0.65;
}
.mlsp-game-card.mlsp-coming-soon .mlsp-card-cta {
  background: var(--mlsp-faint);
  cursor: not-allowed;
  pointer-events: none;
}

/* 404-specific chrome */
.mlsp-404-banner {
  max-width: 680px;
  margin: 1.5rem auto 0.5rem auto;
  background: #fff;
  border-left: 4px solid var(--mlsp-mit-red);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  color: var(--mlsp-text);
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.mlsp-404-banner strong {
  color: var(--mlsp-mit-red);
  font-weight: 700;
}
.mlsp-404-nav {
  text-align: center;
  font-size: 0.9rem;
  color: var(--mlsp-muted);
  margin: 0 auto 1rem auto;
  max-width: 680px;
  padding: 0 1rem;
}
.mlsp-404-nav a {
  color: var(--mlsp-mit-red);
  text-decoration: none;
  font-weight: 500;
  margin: 0 0.2rem;
}
.mlsp-404-nav a:hover { text-decoration: underline; }
.mlsp-404-intro {
  text-align: center;
  color: var(--mlsp-muted);
  font-size: 0.95rem;
  margin: 0.5rem auto 1rem auto;
  max-width: 640px;
  padding: 0 1rem;
}
.mlsp-404-more {
  text-align: center;
  font-size: 0.85rem;
  color: var(--mlsp-muted);
  margin: 0.5rem 0 2rem 0;
}
.mlsp-404-more a {
  color: var(--mlsp-mit-red);
  font-weight: 600;
  text-decoration: none;
}
.mlsp-404-more a:hover { text-decoration: underline; }

.mlsp-404-hero {
  max-width: 860px;
  margin: 1.5rem auto 1rem auto;
  padding: 0 1rem;
  text-align: center;
}
.mlsp-404-eyebrow {
  margin: 0 0 0.45rem 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--mlsp-mit-red);
}
.mlsp-404-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.05;
  color: var(--mlsp-text);
}
.mlsp-404-lede {
  max-width: 720px;
  margin: 0.9rem auto 0 auto;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--mlsp-muted);
}
.mlsp-404-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.15rem;
}
.mlsp-404-primary,
.mlsp-404-secondary {
  border-radius: 999px;
  padding: 0.65rem 1rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
}
.mlsp-404-primary {
  background: var(--mlsp-mit-red);
  color: #fff !important;
}
.mlsp-404-primary:hover { background: #821827; }
.mlsp-404-secondary {
  background: #fff;
  color: var(--mlsp-text) !important;
  border: 1px solid var(--mlsp-border);
}
.mlsp-404-secondary:hover {
  border-color: var(--mlsp-mit-red);
  color: var(--mlsp-mit-red) !important;
}

.mlsp-404-lab {
  max-width: 860px;
  margin: 1.25rem auto 0 auto;
  padding: 0 1rem;
}
.mlsp-404-lab-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.mlsp-404-kicker {
  margin: 0 0 0.25rem 0;
  color: var(--mlsp-mit-red);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.mlsp-404-lab-head h2 {
  margin: 0;
  color: var(--mlsp-text);
  font-size: 1.45rem;
}
.mlsp-404-copy {
  margin: 0.35rem 0 0 0;
  max-width: 620px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--mlsp-muted);
}
.mlsp-404-switcher-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
}
.mlsp-404-switcher-label {
  font-size: 0.78rem;
  color: var(--mlsp-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mlsp-404-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.mlsp-404-chip {
  border: 1px solid var(--mlsp-border);
  background: #fff;
  color: var(--mlsp-text);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}
.mlsp-404-chip:hover,
.mlsp-404-chip.is-active {
  border-color: var(--mlsp-mit-red);
  background: #fff4f6;
  color: var(--mlsp-mit-red);
}
.mlsp-404-footnote {
  max-width: 760px;
  margin: 0.85rem auto 0 auto;
  font-size: 0.9rem;
  color: var(--mlsp-muted);
  line-height: 1.55;
}
.mlsp-404-footnote a {
  color: var(--mlsp-mit-red);
  font-weight: 600;
  text-decoration: none;
}
.mlsp-404-footnote a:hover { text-decoration: underline; }

.mlsp-404-destinations {
  max-width: 860px;
  margin: 1.4rem auto 1.8rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.mlsp-404-destination {
  display: block;
  text-decoration: none;
  border: 1px solid var(--mlsp-border);
  border-radius: 10px;
  background: #fff;
  padding: 0.95rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.mlsp-404-destination strong {
  display: block;
  color: var(--mlsp-text);
  font-size: 0.98rem;
}
.mlsp-404-destination span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--mlsp-muted);
}
.mlsp-404-destination:hover {
  border-color: var(--mlsp-mit-red);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .mlsp-404-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .mlsp-404-primary,
  .mlsp-404-secondary {
    text-align: center;
  }
}

/* ============================================================
   Status pill — appears under the page title to signal stage
   ============================================================ */
.mlsp-status-pill {
  display: inline-block;
  margin: 0 0 1.25rem 0;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--mlsp-orange-stroke);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mlsp-orange-stroke);
  background: transparent;
  letter-spacing: 0.01em;
}
