/* Hoops: a royal blue and orange basketball machine. The canvas is the whole page; the scoreboard, the points a
   basket, and the cards float over it. */

/* The fonts, the prize counter and the toast come from ../shared/arcade.css. */

:root {
  --ink: #fff6e6;
  --ink2: rgba(255, 246, 230, .74);
  --ink3: rgba(255, 246, 230, .5);
  --bg: #0b1030;
  --card: rgba(14, 22, 66, .94);
  --line: rgba(255, 246, 230, .16);
  --red: #ff8a1f;
  --red2: #c75a10;
  --blue: #1d3fa8;
  --blue2: #0f2266;
  --gold: #f2c14e;
  --chrome: #d5dbe4;
  --disp: "Bungee", Impact, sans-serif;
  --body: "Figtree", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* what a card says, and its buttons: side by side on a phone on its side (at the end), and otherwise as if they weren't
   there */
.words, .acts { display: contents; }
[data-single] .to-floor { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  color: var(--ink); font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(ellipse at 50% 0%, rgba(58, 106, 224, .22), transparent 60%), var(--bg);
}
#stage { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
svg { width: 1.3em; height: .9em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the scoreboard ---------- */
.hud {
  position: fixed; left: 0; right: 0; top: 0; z-index: 2; pointer-events: none;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px));
  display: flex; justify-content: space-between; align-items: flex-start;
}
.hud .score { line-height: 1; position: relative; }
/* The cage's near post runs up behind the corner: a soft dark pool behind the score keeps its white line out of the
   numbers, and fades out before the edge so the cage still reads behind it. */
.hud .score::before {
  content: ""; position: absolute; z-index: -1; inset: -12px -22px -12px -16px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(11, 16, 48, .92) 55%, rgba(11, 16, 48, .6) 75%, rgba(11, 16, 48, 0));
}
.hud .score small { display: block; font: 600 11px var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--ink2); margin: 0 0 4px 2px; }
.hud .score b {
  display: inline-block; min-width: 2ch; font: 400 30px/1 var(--disp); color: var(--gold); letter-spacing: .02em;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(255, 170, 60, .55), 0 2px 0 rgba(0, 0, 0, .4);
}
.hud .score b.bump { animation: bump .5s ease-out; }
@keyframes bump { 30% { transform: scale(1.35); } }
.hud .right { display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.hud button {
  height: 40px; border-radius: 999px; border: 1px solid var(--line); background: rgba(11, 16, 48, .6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
/* The 40 px buttons answer a tap 4 px round them too, 48 px in all (a box the layout doesn't see). */
.hud button { position: relative; }
.hud button::after { content: ""; position: absolute; inset: -5px; border-radius: inherit; } /* (from inside the border) */
.hud .tix { display: flex; align-items: center; gap: 6px; padding: 0 12px 0 10px; font: 400 15px var(--disp); }
.hud .menu { width: 40px; display: grid; place-content: center; gap: 4px; padding: 0; }
.hud .menu span { display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--ink); }

/* ---------- the control deck: under the cabinet on a phone, beside it on a wide screen (js/app.js places it) ---------- */
.deck {
  position: fixed; z-index: 1; left: 0; width: 100%; top: calc(100% - 84px); height: 84px; pointer-events: none; /* a flick can start on it */
  display: flex; align-items: center; justify-content: space-evenly; gap: 10px; padding: 8px 14px 12px;
  background: linear-gradient(#2a54c8, #142f86); border-radius: 0 0 20px 20px; border-top: 3px solid var(--red);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .14), inset 0 -4px 0 rgba(0, 0, 0, .3), 0 14px 30px rgba(0, 0, 0, .45);
}
.deck.side { flex-direction: column; justify-content: center; height: auto; padding: 22px 16px; border-radius: 20px; gap: 14px; }
.say { flex: 1; max-width: 12em; font: 400 12px/1.25 var(--disp); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); text-align: center; opacity: .85; text-wrap: balance; }
.deck.side .say { flex: none; }
/* On a narrow phone the deck under the cabinet is narrower (js/app.js marks it): under 290 px the hint goes
   down to 11 px, the smallest size Apple's guidelines give for iOS, in no more lines than the deck has room for, and
   under 245 px, where it can't fit whole at that size, it goes, as the title card says it too. */
.deck.narrow .say { font-size: 11px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.deck.narrower .say { display: none; }
.deck.narrow .worth { min-width: 5em; }
.deck.narrow .worth span { white-space: nowrap; }
/* what a basket's worth now, on the deck: gold in the last ten seconds, alight when the rim is */
.worth { display: flex; flex-direction: column; align-items: center; min-width: 6.5em; line-height: 1; }
.worth b { font: 400 30px var(--disp); color: var(--ink); text-shadow: 0 2px 0 rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; }
.worth span { margin-top: 3px; font: 700 11px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink2); }
.worth.bonus b { color: #ffd23f; }
.worth.hot b { color: #ffb347; text-shadow: 0 0 12px rgba(255, 122, 31, .9), 0 2px 0 rgba(0, 0, 0, .35); animation: throb .35s ease-in-out infinite alternate; }
.worth b.bump { animation: bump .5s ease-out; }
@keyframes throb { to { transform: scale(1.12); } }

/* ---------- cards: title, the end of a round, the menu ---------- */
/* left: over the cabinet on a wide screen, where the deck stands beside it (js/app.js sets --card-x) */
.card {
  position: fixed; z-index: 3; left: var(--card-x, 50%); top: 50%; transform: translate(-50%, -50%);
  width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain;
  padding: 22px 22px 16px; text-align: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card h2 { margin: 2px 0 10px; font: 400 24px/1.15 var(--disp); color: var(--ink); text-wrap: balance; }
.marquee {
  margin: 0 auto 14px; padding: 12px 10px 10px; border-radius: 14px; position: relative;
  background: var(--blue); border: 2px solid var(--red);
  box-shadow: 0 0 0 4px rgba(255, 138, 31, .16), 0 10px 30px rgba(29, 63, 168, .4);
}
.marquee::before, .marquee::after {
  content: ""; position: absolute; left: 10px; right: 10px; height: 6px;
  background: radial-gradient(circle, #fff1c4 0 2px, rgba(255, 220, 140, .35) 2.6px, transparent 3.4px) 0 0 / 14px 6px repeat-x;
  animation: chase .9s steps(2) infinite;
}
.marquee::before { top: 4px; }
.marquee::after { bottom: 4px; animation-delay: .45s; }
@keyframes chase { 50% { background-position: 7px 0; } }
.marquee h1 { margin: 6px 0 4px; font: 400 44px/1 var(--disp); letter-spacing: .04em; color: var(--ink); text-shadow: 3px 3px 0 var(--red2); }
.lede { margin: 0 0 8px; font-weight: 600; text-wrap: balance; }
.how { margin: 0 0 14px; font-size: 14px; color: var(--ink2); }
.best { margin: 12px 0 0; font-size: 13px; color: var(--ink3); min-height: 1em; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.col { display: grid; gap: 8px; margin-bottom: 14px; }
.big, .plain {
  min-height: 48px; padding: 0 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.big { font: 400 18px var(--disp); background: linear-gradient(#ff9c3a, #e36a12); border: 1px solid #ffc08a; color: #fff6e6; box-shadow: 0 4px 0 #8a3e08; text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.big:active { transform: translateY(2px); box-shadow: 0 2px 0 #8a3e08; }
.plain { font-weight: 600; background: rgba(255, 246, 230, .07); border: 1px solid var(--line); }
.plain:active { background: rgba(255, 246, 230, .14); }
a.plain { color: inherit; text-decoration: none; }
/* The way back to the floor is 44 px tall to tap, and placed so its words sit where they did in a 25 px box. */
.floor {
  display: flex; align-items: center; width: max-content; min-height: 44px; margin: -15.5px 0 .5px -10px; padding: 0 10px;
  font: 600 14px var(--body); color: var(--ink2); text-decoration: none;
}
.floor:hover, .floor:focus-visible { color: var(--ink); text-decoration: underline; }
.back { margin: 14px 0 0; font-size: 14px; }
/* 44 px tall to tap, its words where they were */
.back a { display: inline-flex; align-items: center; min-height: 44px; margin: -13.5px -10px; padding: 0 10px; color: var(--ink2); text-decoration: none; }
.back a:hover, .back a:focus-visible { color: var(--ink); text-decoration: underline; }

.jd-foot { margin-top: 16px; font-size: 12px; color: var(--ink3); }
/* each link 44 px tall to tap (and a little wider), its words where they were */
.jd-foot a { padding: 15px 4px; margin: 0 -4px; color: var(--ink3); text-decoration: none; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; color: var(--ink2); }
.jd-foot span { margin: 0 6px; }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .marquee::before, .marquee::after, .hud .score b.bump, .worth.hot b, .worth b.bump { animation: none; }
}

#stage { cursor: grab; }
#stage:active { cursor: grabbing; }

/* ---------- a phone on its side ---------- */
/* Each card in two columns, what it says on the left and its buttons on the right, so Play and the rest are in sight
   without scrolling (and stay in sight if a short window makes the card scroll). It stands in the middle of the screen,
   clear of the notch, over the deck beside the cabinet. The menu has Paused and how to play on the left. */
@media (orientation: landscape) and (max-height: 500px) {
  .card {
    left: 50%; width: min(720px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    max-height: calc(100dvh - 16px); padding: 14px 22px;
    display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 26px; align-items: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 100vmax rgba(0, 0, 0, .45); /* (the rest of the screen dimmed behind it) */
  }
  .words, .acts { display: block; min-width: 0; }
  .acts { position: sticky; top: 0; }
  .card .row { flex-direction: column; align-items: stretch; }
  .acts .row + .row { margin-top: 10px; }
  .marquee { margin-bottom: 10px; padding: 8px 10px 6px; }
  .marquee h1 { margin: 4px 0 2px; font-size: 34px; }
  .fp-payout { min-height: 96px; }
  .fp-strip { max-height: 88px; } /* (the strip of tickets hangs four long, as it does on Tilt's short screens) */
  #menu { grid-template-areas: ". col" "h col" "t col" "k col" "f col" ". col"; grid-template-rows: 1fr repeat(4, auto) 1fr; }
  #menu h2 { grid-area: h; }
  #menu .col { grid-area: col; margin: 0; }
  #menu .touch { grid-area: t; }
  #menu .how.keys { grid-area: k; }
  #menu .jd-foot { grid-area: f; }
}
