/* Race2Moon uses the GaNannGenius playful palette and chunky controls. */
.site-nav { gap: 5px; }
.site-nav-link { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; border: 2px solid transparent; border-radius: 999px; color: var(--muted); text-decoration: none; font: 700 13px/1 "Fredoka", "Nunito", sans-serif; white-space: nowrap; }
.site-nav-link:hover, .site-nav-link.is-current { border-color: #ded6ff; background: #ece7ff; color: #4f33d6; }
.race2moon-view { width: min(1180px, 100%); margin: 0 auto; padding: 36px 24px 70px; }
.race-page-heading { max-width: 740px; margin: 0 auto 28px; text-align: center; }
.race-page-heading h1 { margin: 4px 0; font: 700 clamp(36px, 6vw, 62px)/1.05 "Fredoka", "Nunito", sans-serif; color: var(--ink); }
.race-page-heading > p:last-child { color: var(--muted); line-height: 1.6; font-weight: 600; }
.race-dashboard { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .8fr); gap: 18px; align-items: start; }
.race-card { min-width: 0; padding: clamp(18px, 3vw, 30px); border: 3px solid var(--line); border-radius: 26px; background: #fff; box-shadow: 0 5px 0 #d9d0ff, 0 14px 30px rgba(64,43,160,.12); color: var(--ink); }
.race-card h2 { margin: 4px 0 9px; font: 700 clamp(22px, 3vw, 32px)/1.1 "Fredoka", "Nunito", sans-serif; color: var(--ink); }
.race-card p { color: var(--muted); line-height: 1.55; }
.race-card-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.race-emoji { font-size: 38px; }
.race-create-form, .race-join-form { display: flex; align-items: end; gap: 10px; margin: 14px 0; }
.race-create-form label, .race-join-form label, .race-round label { display: grid; flex: 1; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 800; }
.race-create-form input, .race-join-form input, .race-vote-row select, .race-create-form select, .race-round input { width: 100%; min-height: 46px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); font: inherit; }
.race-button { min-height: 46px; padding: 10px 17px; border: 0; border-radius: 15px; background: var(--teal); box-shadow: 0 5px 0 var(--teal-dark); color: #fff; font: 700 14px/1.1 "Fredoka", "Nunito", sans-serif; cursor: pointer; }
.race-button:hover:not(:disabled) { background: var(--teal-dark); }
.race-button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--teal-dark); }
.race-button:disabled { opacity: .5; cursor: not-allowed; }
.race-secondary { border: 2px solid #ded6ff; background: #f2efff; box-shadow: 0 5px 0 #d2c7ff; color: #4f33d6; }
.race-secondary:hover:not(:disabled) { background: #e6e0ff; }
.race-danger { border: 2px solid #ffd2df; background: #fff2f6; box-shadow: 0 5px 0 #f2b7c8; color: #a52d55; }
.race-divider { height: 2px; margin: 22px 0; background: var(--line); }
.race-actions h3, .race-votes h3, .race-round h3 { margin: 10px 0; color: #4f33d6; font: 600 18px "Fredoka", "Nunito", sans-serif; }
.race-status { min-height: 20px; margin: 10px 0 0; color: #4f33d6; font-size: 13px; font-weight: 700; }
.race-status.is-error { color: #b4234d; }
.race-muted { color: var(--muted) !important; font-size: 13px; }
.race-rules { border-color: #392d89; background: linear-gradient(155deg, #2a2266, #403494 62%, #245d83); color: white; }
.race-rules h2, .race-rules p, .race-rules .eyebrow { color: white; }
.race-rules ul { display: grid; gap: 10px; padding-left: 20px; color: #f3efff; font-size: 14px; line-height: 1.5; }
.race-rules .race-muted { color: #e1dcff !important; }
.race-room-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; padding: 14px; border: 2px solid #ded6ff; border-radius: 18px; background: #f2efff; }
.race-room-banner div { display: grid; gap: 3px; }
.race-room-banner small { color: #62569e; font-size: 10px; font-weight: 900; letter-spacing: .13em; }
.race-room-banner strong { color: #4f33d6; font: 700 25px "Fredoka", "Nunito", sans-serif; letter-spacing: .15em; }
.race-pill { padding: 7px 11px; border-radius: 99px; background: #dff8d9; color: #276a2c; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.race-members { display: grid; gap: 8px; }
.race-member { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px 11px; border: 2px solid var(--line); border-radius: 15px; background: #fff; }
.race-member b { font-size: 13px; overflow-wrap: anywhere; }
.race-member small { color: var(--muted); font-size: 11px; }
.race-member-avatar { display: grid; place-items: center; width: 36px; height: 36px; overflow: hidden; border-radius: 12px; background: #ece7ff; }
.race-member-avatar .avatar-stack { width: 100%; height: 100%; font-size: 31px; }
.race-member-avatar .avatar-stack svg { width: 100%; }
.race-votes { margin-top: 18px; padding: 15px; border-radius: 18px; background: #f5f2ff; }
.race-vote-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.race-vote-row label { display: grid; gap: 5px; font-size: 12px; font-weight: 800; }
.race-vote-row select:disabled { opacity: .7; background: #f2efff; }
.race-round { margin: 16px 0; padding: 16px; border: 2px solid #d8d0ff; border-radius: 20px; background: #fff; }
.race-round-head { display: flex; justify-content: space-between; gap: 8px; }
.race-round-head span { color: #4f33d6; font: 600 18px "Fredoka", "Nunito", sans-serif; }
.race-question { padding: 12px; border-radius: 14px; background: #2a2266; color: #fff !important; font-size: 17px; font-weight: 800; }
.race-round form { display: flex; align-items: end; gap: 9px; }
.race-room-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 17px; }
.race-settings-line { margin: 0 0 10px !important; text-align: center; color: #4f33d6 !important; font-size: 13px; font-weight: 900; letter-spacing: .04em; }
.race-board-wrap { max-width: 700px; margin: 14px auto 18px; overflow-x: auto; padding: 8px; border: 2px solid #43388f; border-radius: 18px; background: #2a2266; box-shadow: 0 6px 0 #1c174a; -webkit-overflow-scrolling: touch; }
.race-board { display: grid; grid-template-columns: repeat(10, minmax(36px, 1fr)); gap: 3px; min-width: 390px; aspect-ratio: 1; }
.race-tile { position: relative; display: flex; min-width: 0; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 3px; border: 1px solid #d8d1ff; border-radius: 7px; overflow: visible; background: linear-gradient(140deg, #fff, #e8e4ff); color: #30275e; }
.race-tile:nth-child(odd) { background: linear-gradient(140deg, #f3fcff, #dff5ff); }
.race-tile.is-start { border-color: #6fdc52; background: #e5ffd9; }
.race-tile.is-goal { border-color: #ffc93c; background: #fff0b9; }
.race-tile > b { font: 700 clamp(10px, 2vw, 14px)/1 "Fredoka", "Nunito", sans-serif; }
.race-tile > span { display: flex; align-items: center; gap: 1px; min-height: 20px; flex-wrap: wrap; overflow: visible; }
.race-token { display: grid; flex: 0 0 23px; place-items: center; width: 23px; height: 23px; border: 2px solid hsl(calc(var(--token)*36) 70% 42%); border-radius: 50%; background: hsl(calc(var(--token)*36) 85% 88%); font-size: 13px; font-style: normal; line-height: 1; }
.race-token .avatar-stack { width: 100%; height: 100%; font-size: 15px; }
.race-token .avatar-stack svg { width: 100%; height: 100%; object-fit: contain; }
.intro[hidden], .arcade[hidden], #tutorial-card[hidden], #race2moon-view[hidden] { display: none !important; }
@media (max-width: 760px) {
  .topbar { gap: 8px; padding-right: 12px; padding-left: 12px; }
  .wordmark { gap: 6px; }
  .brand-mark-gg { width: 34px; height: 34px; flex: 0 0 34px; }
  .topbar-note.site-nav { display: flex !important; }
  .site-nav { gap: 3px; }
  .site-nav-link { min-height: 36px; padding: 7px 9px; font-size: 11px; }
  .race2moon-view { padding: 28px 16px 52px; }
  .race-dashboard { grid-template-columns: 1fr; }
  .race-create-form, .race-join-form { align-items: stretch; flex-direction: column; }
  .race-create-form .race-button, .race-join-form .race-button { width: 100%; }
  .race-member { grid-template-columns: 36px minmax(0, 1fr); }
  .race-member small { grid-column: 2; }
  .race-vote-row { grid-template-columns: 1fr; }
  .race-round form { align-items: stretch; flex-direction: column; }
}
@media (max-width: 420px) {
  .topbar { gap: 6px; padding-right: 8px; padding-left: 8px; }
  .brand-name { font-size: 15px; letter-spacing: -.8px; }
  .site-nav-link { padding: 6px 7px; font-size: 10px; }
  .race-board-wrap { margin-right: -4px; margin-left: -4px; }
}

/* The race page stands alone: puzzle-page extras (chat, grown-up guides) stay on the arcade page. */
.race-mode .info-guides, .race-mode #chat-panel { display: none !important; }

/* Phones: fit the whole 10×10 board on screen so every racer's piece stays visible (no sideways scrolling). */
@media (max-width: 520px) {
  .race-board-wrap { overflow-x: visible; padding: 5px; margin-left: 0; margin-right: 0; }
  .race-board { grid-template-columns: repeat(10, minmax(0, 1fr)); min-width: 0; gap: 2px; }
  .race-tile { padding: 1px 2px; border-radius: 5px; }
  .race-tile > b { font-size: 8px; }
  .race-tile > span { min-height: 0; }
  .race-token { flex-basis: 15px; width: 15px; height: 15px; border-width: 1.5px; font-size: 9px; }
  .race-token .avatar-stack { font-size: 10px; }
}

/* Bigger game pieces on roomy boards so premium critters and gear are easy to see. */
@media (min-width: 521px) {
  .race-token { flex-basis: 36px; width: 36px; height: 36px; border-width: 2.5px; }
  .race-token .avatar-stack { font-size: 20px; }
}

/* Rockets and wormholes */
.race-board { position: relative; }
.race-portals { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.race-rocket-trail, .race-wormhole-trail { fill: none; stroke-width: 0.11; stroke-linecap: round; vector-effect: none; opacity: 0.55; }
.race-rocket-trail { stroke: #ff8a1f; stroke-dasharray: 0.28 0.16; }
.race-wormhole-trail { stroke: #9b5cff; stroke-dasharray: 0.08 0.14; }
.race-rocket-trail.is-firing, .race-wormhole-trail.is-firing { opacity: 1; stroke-width: 0.2; animation: race-trail 0.6s linear infinite; }
@keyframes race-trail { to { stroke-dashoffset: -0.88; } }
.race-tile.is-rocket { background: linear-gradient(140deg, #fff3e2, #ffd9ad); border-color: #ff9a3c; }
.race-tile.is-wormhole { background: linear-gradient(140deg, #f2e9ff, #dccbff); border-color: #9b5cff; }
.race-portal-mark { position: absolute; top: 2px; right: 2px; display: flex; align-items: center; gap: 1px; font-style: normal; font-size: clamp(10px, 2vw, 15px); line-height: 1; z-index: 1; }
.race-portal-mark small { font: 700 clamp(7px, 1.3vw, 10px)/1 "Nunito", sans-serif; color: #5a3a00; }
.race-portal-mark.is-wormhole small { color: #4b2391; }
.race-portal-news { min-height: 1.4em; margin: -6px auto 6px; max-width: 700px; text-align: center; font-weight: 700; color: #3d2a8f; }
.race-portal-news.is-pop { animation: race-pop 0.5s ease-out; }
@keyframes race-pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.race-legend { margin: 0 auto 10px; max-width: 700px; text-align: center; font-size: 13px; color: #6b5fa8; }
@media (max-width: 560px) { .race-portal-mark small { display: none; } .race-portal-mark { top: 1px; right: 1px; font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { .race-rocket-trail.is-firing, .race-wormhole-trail.is-firing, .race-portal-news.is-pop { animation: none; } }
/* Equal rows so trails line up with tiles: pieces on a busy tile overlap instead of growing the row. */
.race-board { grid-template-rows: repeat(10, minmax(0, 1fr)); }
.race-tile { min-height: 0; }
.race-tile > span { flex-wrap: nowrap; position: absolute; left: 2px; right: 2px; bottom: 2px; min-height: 0; }
.race-tile > span .race-token + .race-token { margin-left: -70%; }
.race-portal-mark { flex-direction: column; align-items: flex-end; gap: 0; }
.race-portal-mark small { margin-top: 1px; }
.race-rocket-trail, .race-wormhole-trail { opacity: 0.38; }
