* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #10171e; color: #e6edf3;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.joc { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; }
.barra { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top)); }
.titol { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.1rem; }
.logo-cap { width: 36px; height: 36px; }
.titol small { font-weight: 400; color: #9fb0c0; font-size: .8rem; }
.nivell { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.nivell button { width: 34px; height: 34px; border-radius: 10px; border: 2px solid #5b9bd5; background: transparent;
  color: #5b9bd5; font-size: 1.2rem; font-weight: 700; line-height: 1; cursor: pointer; }
.nivell button:disabled { opacity: .35; }
.pista { position: relative; flex: 1; min-height: 0; touch-action: none; overflow: hidden; border-radius: 14px; margin: 0 8px; }
.pista canvas { display: block; width: 100%; height: 100%; }
.capa { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; background: rgba(10, 16, 22, .72); }
.capa-titol { font-size: 1.5rem; font-weight: 800; margin: 0 0 .4em; }
.capa-text { font-size: 1.05rem; line-height: 1.4; margin: 0 0 1.2em; color: #d5dee7; max-width: 22em; }
.capa-botons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.capa-botons button { padding: 14px 22px; font-size: 1.1rem; font-weight: 700; border: 0; border-radius: 12px;
  background: #2f5d8a; color: #fff; cursor: pointer; }
.capa-botons button.sec { background: transparent; border: 2px solid #5b9bd5; color: #5b9bd5; }
.params { margin: 6px 12px; padding-bottom: env(safe-area-inset-bottom); font-size: .75rem; color: #6f8193; text-align: center; min-height: 1em; }

/* Bàner de rècords: entra per l'esquerra, translúcid */
.banner { position: absolute; left: 0; top: 14%; width: min(84%, 340px); padding: 14px 16px 10px;
  background: rgba(10, 16, 22, .78); border-radius: 0 16px 16px 0; color: #fff;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transform: translateX(-105%); transition: transform .45s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.banner.obert { transform: translateX(0); }
.banner-titol { margin: 0 0 8px; font-weight: 800; font-size: 1.05rem; }
.banner-llista { list-style: none; margin: 0; padding: 0; }
.banner-llista li { display: flex; gap: 8px; align-items: baseline; padding: 5px 6px; border-radius: 8px; font-size: 1rem; }
.banner-llista .pos { width: 2.2em; color: #f2b705; font-weight: 800; }
.banner-llista .nom { flex: 1; font-weight: 600; }
.banner-llista .niv { color: #9fb0c0; font-size: .85rem; }
.banner-llista .km { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 4.5em; text-align: right; }
.banner-llista li.jo { background: rgba(242, 183, 5, .25); }
.banner-llista li.sep { height: 1px; padding: 0; margin: 4px 0; background: rgba(255,255,255,.25); }
.anterior { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 9px 14px;
  border: 0; border-radius: 10px; background: rgba(10,16,22,.75); color: #fff; font-weight: 700; font-size: .95rem; }

/* Entrada amb nom */
.entrada { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; max-width: 320px; }
.entrada input { flex: 1 1 100%; font-size: 18px; padding: 13px 14px; border-radius: 12px; border: 2px solid #5b9bd5;
  background: rgba(255,255,255,.95); color: #1d2a36; text-align: center; }
.entrada input:focus { outline: none; border-color: #f2b705; }
.entrada button { flex: 1 1 100%; }
.entrada-error { flex: 1 1 100%; margin: 0; color: #ffb4a8; font-size: .95rem; }
.jugador { margin-left: auto; margin-right: 10px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: none; border: 0; color: #d5dee7; font: inherit; font-size: .9rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.jugador:hover { background: rgba(255,255,255,.08); }
.banner { top: 8%; max-height: 84%; overflow: hidden; }
.params { color: #f5b4ac; }
