/* ForkFree Arcade pages (hub and game pages). Uses the site's colour tokens from /style.css.
   Rule for ads: every ad box stays at least --ad-clear (150px) away from the game stage. */
.gm { --ad-clear: 150px; --stage-w: 460px; padding: clamp(1rem, 3vw, 2rem) var(--g) 3rem; max-width: 82rem; margin: 0 auto; }
.gm-top { max-width: 46rem; margin: 0 auto 1rem; text-align: center; }
.gm-top h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.gm-tag { margin: 0.35rem auto 0; color: var(--ink-2); max-width: 40ch; }
.gm-reset { margin-top: 0.4rem; font-size: 0.92rem; color: var(--ink-3); }
.gm-reset b { color: var(--ink); }
.gm-back { display: inline-block; margin-bottom: 0.2rem; font-size: 0.88rem; color: var(--ink-3); }
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* The arena: rails and stage. Rails appear only when there is room for 150px of clear space on each side of the stage. */
.gm-arena { display: block; }
.gm-rail { display: none; }
.gm-stage {
  width: min(100%, var(--stage-w)); margin: 0 auto;
  height: min(calc(100dvh - 10.5rem), 820px); min-height: 28rem;
  border-radius: 20px; overflow: hidden; background: #0b0414;
  overscroll-behavior: none; touch-action: manipulation; contain: layout paint;
  box-shadow: 0 20px 50px -24px rgb(0 0 0 / 0.6);
}
.gm-stage iframe { display: block; width: 100%; height: 100%; border: 0; overscroll-behavior: none; }
@media (max-width: 700px) {
  .gm { padding-top: 0.6rem; }
  .gm-top { margin-bottom: 0.6rem; }
  .gm-top h1 { font-size: 1.4rem; }
  .gm-back, .gm-tag { display: none; }
  .gm-reset { margin-top: 0.25rem; font-size: 0.8rem; }
  .gm-hub .gm-tag { display: block; }
}
@media (min-width: 701px) { .gm-stage { height: min(calc(100dvh - 17rem), 820px); } .gm-hub .gm-top h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); } }
.gm-hint { margin-top: 0.9rem; text-align: center; font-size: 0.88rem; color: var(--ink-3); }
@media (min-width: 1180px) {
  .gm-arena { display: grid; grid-template-columns: 160px minmax(var(--ad-clear), 1fr) var(--stage-w) minmax(var(--ad-clear), 1fr) 160px; align-items: start; }
  .gm-arena .gm-stage { grid-column: 3; margin: 0; }
  .gm-rail { display: block; min-height: 0; }
  .gm-rail:first-child { grid-column: 1; }
  .gm-rail:last-child { grid-column: 5; }
}

/* Below-the-fold slots: structurally more than 150px from the stage (rules and scoring sit between), and never an empty box */
.gm-ad { margin: 2.4rem 0; min-height: 0; overflow: hidden; }
.gm-ad:empty { display: none; }
.gm-ad-hub { max-width: 46rem; margin-inline: auto; }

.gm-content { max-width: 46rem; margin: 2.4rem auto 0; }
.gm-content section { margin-top: 2.4rem; }
.gm-content h2 { font-size: 1.4rem; margin-bottom: 0.8rem; }
.gm-q { font-size: 1.05rem; margin: 1.2rem 0 0.3rem; }
.gm-steps { margin: 0.8rem 0 0; padding-left: 1.3rem; display: grid; gap: 0.5rem; }
.gm-steps li::marker { color: var(--signal); font-weight: 700; }
.gm-score { margin: 0.8rem 0 0; display: grid; gap: 0; border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; background: var(--card); }
.gm-score div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: 0.8rem 1rem; border-top: 1px solid var(--rule); }
.gm-score div:first-child { border-top: 0; }
.gm-score dt { font-weight: 700; }
.gm-score dd { margin: 0; color: var(--ink-2); }
@media (max-width: 34rem) { .gm-score div { grid-template-columns: 1fr; gap: 0.2rem; } }
.gm-more { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.7rem; }
.gm-more li { display: grid; gap: 0.1rem; }
.gm-more a { font-weight: 700; }
.gm-more span { color: var(--ink-3); font-size: 0.92rem; }
.gm-notice { padding: 1rem 1.2rem; border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-2); }
.gm-notice h2 { font-size: 1.1rem; }

/* Hub */
.gm-grid { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr)); }
.gm-card a { display: grid; gap: 0.35rem; height: 100%; padding: 0 0 1rem; text-decoration: none; background: var(--card); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.gm-card a:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: inherit; }
.gm-card img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; background: #0b0414; }
.gm-card-name { padding: 0.5rem 1rem 0; font-weight: 700; font-size: 1.1rem; }
.gm-card-tag { padding: 0 1rem; color: var(--ink-2); font-size: 0.93rem; }
.gm-card-go { margin: 0.4rem 1rem 0; font-weight: 600; color: var(--signal-ink); }

@media (prefers-reduced-motion: reduce) { .gm-card a { transition: none; } .gm-card a:hover { transform: none; } }

/* Leaderboards and sign-up */
.gm-lb { max-width: 46rem; margin: 1.6rem auto 0; padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--rule); border-radius: 16px; }
.gm-lb h2, .gm-lb h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.gm-lb h3 { font-size: 1rem; }
.gm-lb-pulse { margin: -0.2rem auto 0.8rem; max-width: 46rem; font-size: 0.9rem; color: var(--ink-2); }
.gm-lb-pulse-hub { text-align: center; margin-top: 1rem; }
.gm-lb-empty { color: var(--ink-3); font-size: 0.93rem; }
.gm-lb-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; font-variant-numeric: tabular-nums; }
.gm-lb-table th { text-align: left; font: 500 0.72rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); padding: 0 0.5rem 0.5rem 0; }
.gm-lb-table td { padding: 0.45rem 0.5rem 0.45rem 0; border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.gm-lb-table tr.me td { font-weight: 700; color: var(--signal-ink); }
.gm-lb-foot { margin-top: 0.6rem; font-size: 0.85rem; color: var(--ink-3); }
.gm-lb-join { margin-top: 1rem; display: grid; gap: 0.4rem; }
.gm-lb-join label { font-weight: 600; font-size: 0.93rem; }
.gm-lb-row { display: flex; gap: 0.5rem; }
.gm-lb-row input { flex: 1; min-width: 0; min-height: 2.9rem; padding: 0 1rem; font: inherit; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
.gm-lb-join.joined .gm-lb-row, .gm-lb-join.joined label { display: none; }
.gm-hub-boards { max-width: 82rem; margin: 2.4rem auto 0; }
.gm-hub-boards h2 { font-size: 1.4rem; margin-bottom: 1rem; text-align: center; }
.gm-lb-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.gm-lb-grid .gm-lb { margin: 0; padding: 0.9rem 1rem; }
.gm-hub-boards .gm-lb-join { max-width: 28rem; margin: 1.2rem auto 0; }

/* Leaderboard rows (ranked list with a progress bar per player) and the gameplay preview */
.gm-lb { border-radius: 20px; background: linear-gradient(180deg, color-mix(in oklch, var(--card) 92%, var(--signal)) 0, var(--card) 5.5rem); }
.gm-lb h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; }
.gm-lb h2::before { content: "🏆"; font-size: 1.1em; }
.gm-lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.gm-lb-item { display: grid; grid-template-columns: 2.1rem minmax(0, 1fr) auto 4.6rem; align-items: center; gap: 0.7rem; padding: 0.55rem 0.7rem; border-radius: 12px; background: var(--paper); border: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.gm-lb-rank { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; font-weight: 700; font-size: 0.92rem; background: var(--paper-2); color: var(--ink-2); }
.gm-lb-item.top1 .gm-lb-rank { background: oklch(0.83 0.15 88); color: oklch(0.3 0.06 88); }
.gm-lb-item.top2 .gm-lb-rank { background: oklch(0.86 0.01 262); color: oklch(0.3 0.02 262); }
.gm-lb-item.top3 .gm-lb-rank { background: oklch(0.74 0.1 55); color: oklch(0.28 0.06 55); }
.gm-lb-item.top1 { border-color: oklch(0.83 0.15 88 / 0.7); }
.gm-lb-who { display: grid; gap: 0.3rem; min-width: 0; }
.gm-lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-lb-name em { font-style: normal; font: 500 0.68rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 0.15rem 0.4rem; border-radius: 999px; background: var(--signal-soft); color: var(--signal-ink); margin-left: 0.3rem; }
.gm-lb-bar { display: block; height: 5px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.gm-lb-bar i { display: block; height: 100%; border-radius: 999px; background: var(--signal); }
.gm-lb-res { display: grid; justify-items: end; gap: 0.1rem; font-size: 0.95rem; }
.gm-lb-clear { font: 500 0.66rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ok); }
.gm-lb-time { text-align: right; color: var(--ink-2); font-size: 0.9rem; }
.gm-lb-item.me { border-color: var(--signal); background: var(--signal-soft); }
.gm-lb-mine { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--rule); }
.gm-lb-empty { padding: 1.2rem 1rem; text-align: center; border: 1px dashed var(--rule); border-radius: 12px; color: var(--ink-2); }
.gm-lb-empty p { margin: 0 auto; max-width: none; }
.gm-lb-empty-sub { font-size: 0.88rem; color: var(--ink-3); }
.gm-lb-grid .gm-lb-item { grid-template-columns: 1.8rem minmax(0, 1fr) auto; padding: 0.45rem 0.55rem; gap: 0.5rem; }
.gm-lb-grid .gm-lb-time { display: none; }
.gm-lb-grid .gm-lb-rank { width: 1.8rem; height: 1.8rem; font-size: 0.82rem; }
.gm-lb-grid .gm-lb h3 { display: flex; justify-content: space-between; align-items: baseline; }
@media (max-width: 26rem) { .gm-lb-item { grid-template-columns: 1.9rem minmax(0, 1fr) auto; } .gm-lb-time { display: none; } }
.gm-preview { margin: 1.4rem 0 0; display: grid; justify-items: center; gap: 0.5rem; }
.gm-preview video { width: min(100%, 15rem); height: auto; aspect-ratio: 9 / 16; border-radius: 16px; background: #0b0414; box-shadow: var(--shadow); }
.gm-preview figcaption { font-size: 0.86rem; color: var(--ink-3); text-align: center; }

/* Leaderboard period tabs and medal chips */
.gm-lb-tabs { display: inline-flex; gap: 0.25rem; padding: 0.2rem; margin-bottom: 0.8rem; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule); }
.gm-lb-tabs button { min-height: 2.2rem; padding: 0 0.9rem; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.gm-lb-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.gm-card-medal { margin: 0.2rem 1rem 0; justify-self: start; padding: 0.2rem 0.6rem; border-radius: 999px; font: 500 0.7rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; background: var(--signal-soft); color: var(--signal-ink); }
.gm-card-medal[hidden] { display: none; }

/* Past courses */
.gm-past-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.gm-past-list a { display: inline-flex; gap: 0.4rem; align-items: baseline; padding: 0.45rem 0.8rem; border-radius: 999px; border: 1px solid var(--rule); background: var(--card); text-decoration: none; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.gm-past-list a:hover { border-color: var(--ink-3); }
.gm-past-list a[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.gm-past-pick { margin-top: 1rem; display: grid; gap: 0.4rem; max-width: 24rem; }
.gm-past-pick label { font-weight: 600; font-size: 0.93rem; }
.gm-past-note { max-width: 46rem; margin: 0.9rem auto 0; padding: 0.7rem 1rem; border-radius: 12px; background: var(--signal-soft); color: var(--ink); font-size: 0.93rem; text-align: center; }
.gm-past-note[hidden] { display: none; }

/* Hub card loops and the visual guide */
.gm-card-loop { display: block; width: 100%; height: auto; aspect-ratio: 600 / 314; object-fit: cover; background: #0b0414; }
.gm-guide-list { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: 1rem; }
.gm-guide-list li { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); gap: 1.1rem; align-items: center; padding: 0.9rem; border-radius: 16px; background: var(--card); border: 1px solid var(--rule); }
.gm-guide-list img { display: block; width: 100%; height: auto; border-radius: 12px; background: #0b0414; }
.gm-guide-list h3 { display: flex; align-items: center; gap: 0.6rem; font-size: 1.08rem; margin-bottom: 0.4rem; }
.gm-guide-list h3 span { display: grid; place-items: center; flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--signal); color: #fff; font-size: 0.85rem; }
.gm-guide-list p { color: var(--ink-2); font-size: 0.96rem; max-width: none; }
@media (max-width: 30rem) { .gm-guide-list li { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); gap: 0.8rem; padding: 0.7rem; } }

/* Guest games (made by players) */
.gm-guests { margin: 2.6rem 0 0; }
.gm-guests h2 { font-size: 1.4rem; text-align: center; }
.gm-guests-sub { margin: 0.4rem auto 0; text-align: center; color: var(--ink-2); max-width: 40ch; }
.gm-card-by { margin: 0 1rem; justify-self: start; padding: 0.2rem 0.6rem; border-radius: 999px; font: 500 0.7rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; background: var(--signal-soft); color: var(--signal-ink); }
.gm-maker { margin-top: 0.5rem; display: inline-block; padding: 0.3rem 0.9rem; border-radius: 999px; background: var(--signal-soft); color: var(--signal-ink); font-size: 0.95rem; }
.gm-stage-wide { width: min(100%, 60rem); height: min(calc(100dvh - 17rem), 38rem); min-height: 26rem; }
@media (max-width: 700px) { .gm-guest .gm-tag { display: none; } .gm-stage-wide { height: calc(100dvh - 12.5rem); min-height: 30rem; } }
.gm-made-by { padding: 1rem 1.2rem; border-radius: 14px; background: var(--signal-soft); }
.gm-made-by h2 { font-size: 1.2rem; }

/* Watch the AI: the full run, under the game */
.gm-watch { max-width: 46rem; margin: 1.6rem auto 0; padding: 1rem; display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 1.2rem; align-items: center; border-radius: 20px; background: var(--card); border: 1px solid var(--rule); }
.gm-watch video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 14px; background: #0b0414; }
.gm-watch h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.gm-watch p { color: var(--ink-2); font-size: 0.96rem; max-width: none; }
.gm-watch-dare { margin-top: 0.6rem; font-weight: 600; color: var(--signal-ink) !important; }
@media (max-width: 30rem) { .gm-watch { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); gap: 0.9rem; padding: 0.8rem; } .gm-watch h2 { font-size: 1.08rem; } }
