/* Ramp Rally: its own look (Doug, 1 Oct: every game looks like itself). A blueprint table with toy plastic track:
   orange, lime and blue like the set in Doug's photo, chunky comic letters (Luckiest Guy, Apache 2.0). */
@font-face {
  font-family: 'Luckiest Guy';
  src: url(/fonts/luckiest-guy.woff2) format('woff2');
  font-display: swap;
}
:root {
  --bp: #1d58b8;
  --bp2: #16418c;
  --orange: #ff8a1f;
  --lime: #a6e22e;
  --toy-blue: #2f7dff;
  --yellow: #ffd21f;
  --ink: #1a1630;
  --paper: #fff8ec;
}
html, body.rr { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.rr { background: var(--bp2); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 600; }
.rr h1, .rr h2, .rr h3, .rr button, .rr .tile-btn b { font-family: 'Luckiest Guy', Fredoka, system-ui, sans-serif; font-weight: 400; letter-spacing: .03em; }
.rr button { border-radius: 14px; }
.rr button.quiet { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 700; letter-spacing: 0; border-color: #ffffff55; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
.rr #app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* top bar */
.rr-top { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); pointer-events: none; }
.rr-top > * { pointer-events: auto; }
.rr-top button.small { min-height: 44px; min-width: 44px; padding: 6px 10px; }
#back-slot:empty { display: none; }
.where { flex: 1; min-width: 0; margin: 0; font-size: 20px; color: var(--paper); text-shadow: 0 2px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-home .where { visibility: hidden; }
@media (max-width: 560px) { .rr-top:has(.fuel:not(.hidden)) .where { display: none; } .rr-top .fuel { margin-left: auto; } }
.fuel { display: flex; align-items: center; gap: 6px; background: #00000044; border: 2px solid #ffffff44; border-radius: 99px; padding: 4px 10px; }
.fuel .gauge { width: min(28vw, 150px); height: 12px; border-radius: 99px; background: #ffffff22; border: 2px solid var(--ink); overflow: hidden; }
.fuel i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff4b2b, #ffd21f 35%, #7dff8a); transition: width .1s linear; }
.fuel.low { animation: rr-blink .5s steps(2) infinite; }
@keyframes rr-blink { 50% { border-color: #ff4b2b; } }

#stage { position: relative; flex: 1; min-height: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* whose turn (Build Together) */
.turn { position: absolute; z-index: 6; left: 50%; top: calc(max(6px, env(safe-area-inset-top)) + 54px); transform: translateX(-50%) rotate(-1.5deg); background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 14px; font-family: 'Luckiest Guy', sans-serif; font-size: 20px; letter-spacing: .03em; box-shadow: 0 4px 0 var(--ink); white-space: nowrap; }
.turn.pass { animation: g-pop .3s cubic-bezier(.2,1.6,.4,1); }
.toast { position: absolute; z-index: 7; left: 50%; top: calc(max(6px, env(safe-area-inset-top)) + 96px); transform: translateX(-50%); width: max-content; max-width: min(92vw, 520px); box-sizing: border-box; text-align: center; background: #1a1630e6; border: 2px solid #ffffff44; border-radius: 16px; padding: 6px 14px; font-size: 15px; color: var(--paper); }
@media (max-height: 460px) { .toast { top: calc(max(6px, env(safe-area-inset-top)) + 52px); } .turn { top: calc(max(6px, env(safe-area-inset-top)) + 4px); font-size: 17px; } }

/* the tray */
.buildbar { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: linear-gradient(180deg, #0e2a5ecc, #0e2a5ef2); border-top: 3px solid var(--ink); }
.tray { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
.tray::-webkit-scrollbar { display: none; }
.piece-btn { position: relative; flex: none; width: 64px; min-height: 64px; padding: 2px 2px 4px; display: grid; justify-items: center; gap: 0; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); font-family: system-ui, sans-serif !important; font-weight: 800 !important; font-size: 11px !important; letter-spacing: 0 !important; line-height: 1.05; }
.piece-btn svg { width: 38px; height: 38px; }
.piece-btn .n { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 99px; background: var(--toy-blue); color: #fff; border: 2px solid var(--ink); font-size: 13px; line-height: 20px; }
.piece-btn[aria-checked="true"] { background: var(--yellow); transform: translateY(-4px); box-shadow: 0 8px 0 var(--ink); }
.piece-btn:disabled { opacity: .4; }
.bb-btns { display: flex; align-items: center; gap: 8px; flex: none; }
.go-btn { background: var(--orange); color: var(--ink); font-size: 24px; padding: 8px 18px; min-height: 56px; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
.go-btn.green { background: var(--lime); }
.go-btn.wide { width: 100%; margin-top: 16px; }
#race { animation: rr-nudge 2.4s ease-in-out infinite; }
@keyframes rr-nudge { 0%, 80%, 100% { transform: none; } 88% { transform: rotate(-3deg) scale(1.05); } 94% { transform: rotate(3deg) scale(1.05); } }
@media (max-height: 460px) {
  .buildbar { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .piece-btn { width: 58px; min-height: 52px; }
  .piece-btn svg { width: 30px; height: 30px; }
  .piece-btn > span:not(.n) { display: none; }
  .go-btn { min-height: 50px; font-size: 21px; }
}
@media (max-width: 560px) {
  .buildbar { flex-wrap: wrap; }
  .tray { flex-basis: 100%; }
  .bb-btns { flex: 1; justify-content: flex-end; }
  .bb-btns #race { flex: 1; }
}

/* pedals: big thumbs, bottom corners */
.pedals { position: absolute; z-index: 8; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 0 max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); pointer-events: none; }
.pedal { pointer-events: auto; width: clamp(96px, 24vw, 150px); height: clamp(72px, 18vh, 120px); font-size: 26px; border-radius: 22px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pedal.gas { background: var(--lime); }
.pedal.brake { background: #ff5d5d; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.pedal.on { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 var(--ink); filter: brightness(1.1); }

/* pages over the board */
.page { position: absolute; inset: 0; z-index: 10; overflow-y: auto; padding: calc(max(6px, env(safe-area-inset-top)) + 58px) 16px max(16px, env(safe-area-inset-bottom)); background: #16418cf2; color: var(--paper); }
.page > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.page h2 { font-size: 30px; text-align: center; text-shadow: 0 3px 0 var(--ink); }
.page h3 { margin: 18px auto 8px; font-size: 20px; }
.small-line { text-align: center; margin: 6px auto 14px; font-size: 15px; color: #d6e4ff; }
.muted { color: #d6e4ff; }

.home { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: linear-gradient(180deg, #16418c66, #16418ce8 62%); overflow: hidden; }
.rr-logo { margin: 0; }
.rr-logo .word { display: block; font-size: clamp(48px, 13vw, 84px); line-height: .9; color: var(--yellow); -webkit-text-stroke: 3px var(--ink); text-shadow: 0 6px 0 var(--ink); transform: rotate(-4deg); text-align: center; }
.rr-logo .word em { display: block; font-style: normal; color: var(--orange); transform: translateX(.6em) rotate(2deg); }
.tag { margin: 0; text-align: center; font-size: 16px; max-width: 360px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 560px; }
.tile-btn { display: grid; justify-items: center; gap: 2px; padding: 12px 8px; min-height: 120px; background: var(--orange); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); }
.tile-btn.red { background: #ff5d5d; }
.tile-btn.blue { background: #6fb6ff; }
.tile-btn .ic { font-size: 34px; line-height: 1; }
.tile-btn b { font-size: 22px; line-height: 1.05; }
.tile-btn small { font-family: system-ui, sans-serif; font-size: 12.5px; font-weight: 700; letter-spacing: 0; line-height: 1.2; }
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr 1fr; } .tile-btn.blue { grid-column: 1 / -1; min-height: 76px; } }
@media (max-height: 460px) { .home { gap: 6px; } .rr-logo .word { font-size: 46px; } .tile-btn { min-height: 92px; padding: 8px; } .tile-btn .ic { font-size: 26px; } .tag { display: none; } }
.diff-pick { display: grid; gap: 4px; justify-items: center; }
.diff-pick .chips button { min-height: 44px; padding: 4px 14px; font-size: 17px; }
.diff-blurb { margin: 0; font-size: 14px; color: #d6e4ff; text-align: center; min-height: 1.2em; }
@media (max-height: 460px) { .diff-blurb { display: none; } .diff-pick .chips button { min-height: 40px; } }
.row-btns { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.quiet-link { color: var(--paper); font-weight: 700; }

.lv-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lv-grid button { width: 100%; min-height: 84px; display: grid; gap: 2px; justify-items: center; background: var(--paper); color: var(--ink); font-size: 18px; }
.lv-grid button .num { font-size: 13px; font-family: system-ui, sans-serif; font-weight: 800; letter-spacing: 0; color: #5a5470; }
.lv-grid button .stars { font-size: 16px; letter-spacing: 2px; font-family: system-ui, sans-serif; }
.lv-grid button:disabled { background: #ffffff33; color: #ffffffaa; box-shadow: none; }

.chips { display: flex; gap: 8px; justify-content: center; }
.chips.wrap { flex-wrap: wrap; }
.chips button { min-height: 48px; padding: 6px 16px; background: var(--paper); color: var(--ink); font-size: 18px; box-shadow: 0 4px 0 var(--ink); }
.chips button[aria-checked="true"] { background: var(--yellow); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.names input { width: 100%; min-height: 48px; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 10px; font: 700 17px system-ui, sans-serif; color: var(--ink); background: var(--paper); box-sizing: border-box; }

.how-list { padding-left: 22px; line-height: 1.45; font-size: 16.5px; }
.how-list li + li { margin-top: 8px; }

/* the end card */
.end { display: grid; place-items: center; background: #0e2a5ecc; }
.end-card { width: min(440px, 100%); background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 24px; padding: 18px 20px; box-shadow: 0 10px 0 var(--ink); text-align: center; animation: g-pop .35s cubic-bezier(.2,1.6,.4,1); }
.end-card h2 { color: var(--orange); font-size: 40px; -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 var(--ink); transform: rotate(-2deg); }
.end-card.won h2 { color: var(--lime); }
.end-line { margin: 8px 0; font-size: 17px; }
.end-stars { font-size: 38px; letter-spacing: 4px; min-height: 0; }
.end-stars .off { filter: grayscale(1); opacity: .3; }
.end-score { display: grid; justify-items: center; margin: 6px 0; }
.end-score b { font-family: 'Luckiest Guy', sans-serif; font-weight: 400; font-size: 46px; line-height: 1; color: #ff4b2b; }
.end-score span { font-weight: 800; }
.end-score small { color: #5a5470; }
.end-facts { list-style: none; padding: 0; margin: 6px 0; color: #5a5470; font-size: 15px; }
.end-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.end-btns .go-btn { grid-column: 1 / -1; }
.rr .end-btns .quiet { color: var(--ink); border-color: var(--ink); border-width: 3px; }
.sent { grid-column: 1 / -1; margin: 0; min-height: 1.2em; color: #5a5470; font-size: 14px; }
@media (max-height: 460px) {
  .end { padding-top: max(8px, env(safe-area-inset-top)); z-index: 25; }
  .end-card { width: min(640px, 100%); padding: 10px 14px; }
  .end-card h2 { font-size: 30px; }
  .end-line { margin: 4px 0; font-size: 15px; }
  .end-stars { font-size: 26px; }
  .end-score b { font-size: 32px; }
  .end-facts { margin: 2px 0; font-size: 13.5px; }
  .end-facts li { display: inline; }
  .end-facts li + li::before { content: ' · '; }
  .end-btns { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 6px; }
  .end-btns .go-btn { grid-column: auto; }
  .end-btns button { min-height: 46px; font-size: 16px; padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) { #race, .fuel.low, .turn.pass, .end-card { animation: none; } }
