/* Tilt: the backbox display across the top, the table filling the rest, and cards for the menus. */

@font-face { font-family: "Bungee"; src: url(../fonts/bungee.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Figtree"; src: url(../fonts/figtree.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --bg: #05070d;
  --ink: #f6efe0;
  --ink2: rgba(246, 239, 224, .74);
  --ink3: rgba(246, 239, 224, .5);
  --amber: #ffa53a;
  --amber-dim: rgba(255, 165, 58, .16);
  --red: #e63946;
  --card: rgba(14, 22, 44, .9);
  --line: rgba(246, 239, 224, .16);
  --disp: "Bungee", Impact, sans-serif;
  --body: "Figtree", system-ui, sans-serif;
  --hud: calc(58px + env(safe-area-inset-top, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}

/* ---- the backbox: ball number, score display, menu ---- */
.backbox {
  position: fixed; left: 0; right: 0; top: 0; height: var(--hud);
  padding: env(safe-area-inset-top, 0px) 10px 0;
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 8px;
  background: linear-gradient(#0d0a08, #050403); border-bottom: 1px solid #2a1a0a;
}
.ball { font: 12px/1.1 var(--disp); color: var(--amber); opacity: .85; letter-spacing: .04em; }
.display {
  height: 42px; border-radius: 6px; background: #120a02;
  box-shadow: inset 0 0 0 1px #3a2208, inset 0 2px 8px rgba(0, 0, 0, .8);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font: 26px/1 var(--disp); color: var(--amber); letter-spacing: .04em;
  text-shadow: 0 0 6px rgba(255, 140, 30, .7), 0 0 16px rgba(255, 120, 20, .35);
  background-image: radial-gradient(rgba(255, 165, 58, .07) 1px, transparent 1.2px); background-size: 4px 4px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.display.msg { font-size: 18px; text-transform: uppercase; animation: flash .3s steps(2) 3; }
@keyframes flash { 50% { opacity: .35; } }
.menu {
  justify-self: end; width: 44px; height: 44px; border-radius: 10px; border: 1px solid #3a2208;
  background: #120a02; color: var(--amber); display: grid; place-items: center; cursor: pointer;
}
.menu:active { background: #24140a; }

/* ---- the table ---- */
.stage { position: fixed; left: 0; right: 0; top: var(--hud); bottom: 0; touch-action: none; }
#table { display: block; width: 100%; height: 100%; }
.launch {
  position: absolute; width: 72px; height: 78px; border-radius: 14px;
  border: 1px solid rgba(255, 165, 58, .55); background: rgba(18, 10, 2, .72); color: var(--amber);
  font: 11px/1 var(--disp); letter-spacing: .05em; cursor: pointer; overflow: hidden; touch-action: none;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.launch .lbl { position: relative; }
.launch .lbl::before { content: "▲"; display: block; text-align: center; font-size: 16px; margin-bottom: 6px; }
.launch .meter { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(var(--amber), #e2551a); opacity: .5; }

/* ---- menus ---- */
.sheet {
  position: fixed; inset: var(--hud) 0 0 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(3, 5, 10, .45);
}
.card {
  width: min(380px, 100%); max-height: 100%; overflow: auto; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px 22px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  user-select: text; -webkit-user-select: text;
}
h1 {
  margin: 0; font: 64px/1 var(--disp); color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 140, 30, .6), 0 3px 0 #a33a10;
}
h2 { margin: 0; font: 30px/1.1 var(--disp); color: var(--amber); }
.lede { margin: 8px 0 18px; color: var(--ink2); }
.go {
  display: block; width: 100%; padding: 14px 18px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(#ffb04d, #f07a1a); color: #2a1200; font: 18px var(--disp); letter-spacing: .03em;
  box-shadow: 0 3px 0 #a2420c;
}
.go:active { transform: translateY(2px); box-shadow: 0 1px 0 #a2420c; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.ghost {
  flex: 1; padding: 11px 10px; border-radius: 12px; border: 1px solid var(--line); background: transparent;
  color: var(--ink); font: 600 15px var(--body); cursor: pointer;
}
.ghost:active { background: rgba(255, 255, 255, .06); }
.best { margin: 12px 0 0; color: var(--ink3); font-size: 14px; min-height: 1.4em; }
.how { margin-top: 14px; text-align: left; border-top: 1px solid var(--line); padding-top: 10px; }
.how summary { cursor: pointer; color: var(--ink2); font-weight: 600; text-align: center; }
.how ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink2); font-size: 14px; }
.how li { margin: 6px 0; }
.how b { color: var(--ink); }
.final { margin: 10px 0 0; font: 40px/1 var(--disp); color: var(--ink); font-variant-numeric: tabular-nums; }
.note { margin: 6px 0 0; color: var(--amber); min-height: 1.4em; }
.scores { margin: 14px auto 18px; padding: 0; list-style: none; max-width: 240px; counter-reset: n; }
.scores li {
  counter-increment: n; display: flex; justify-content: space-between; gap: 10px; padding: 4px 0;
  border-bottom: 1px solid var(--line); color: var(--ink2); font-variant-numeric: tabular-nums;
}
.scores li::before { content: counter(n) "."; color: var(--ink3); width: 1.5em; text-align: left; }
.scores li span { flex: 1; text-align: right; }
.scores li.me { color: var(--amber); font-weight: 700; }
.scores li small { color: var(--ink3); }

button:focus-visible, summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.jd-foot { margin: 16px 0 0; font: 400 13px/1.4 var(--body); color: var(--ink3); }
.jd-foot a { color: inherit; text-decoration: none; border-radius: 2px; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; text-underline-offset: 3px; color: var(--ink2); }

.noscript { position: fixed; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font: 22px var(--disp); color: var(--amber); }

@media (max-height: 640px) { h1 { font-size: 48px; } .card { padding: 18px 18px 14px; } }
@media (prefers-reduced-motion: reduce) { .display.msg { animation: none; } }
