@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/Fredoka-latin.woff2') format('woff2');
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0d22;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#game {
  display: block;
  position: fixed;
  inset: 0;
  cursor: crosshair;
}

/* ================================================================ laaiskerm */
.splash {
  --gold: #ffd23a;
  --ink: #3a1a00;
  --sky: #c8d4ff;
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: Fredoka, 'Trebuchet MS', 'Arial Rounded MT Bold', sans-serif;
  background: linear-gradient(180deg, #070920 0%, #111947 34%, #33296a 60%, #8e3f78 80%, #ff8a5c 100%);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.splash.is-leaving {
  opacity: 0;
  transform: scale(1.08);
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.5, 0, 0.75, 0);
}

.splash.is-gone {
  display: none;
}

/* -- lug, sterre, dorp en straat */
.splash-sky,
.splash-stars,
.splash-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash-stars {
  bottom: 45%;
  background-image:
    radial-gradient(1.6px 1.6px at 6% 18%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 14% 52%, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 22% 8%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 31% 36%, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 43% 14%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 57% 30%, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 66% 10%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 74% 46%, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 83% 22%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 92% 6%, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 96% 40%, #fff 50%, transparent 52%);
  opacity: 0.85;
}

.splash-stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 10% 30%, #fff 50%, transparent 52%),
    radial-gradient(1.8px 1.8px at 27% 22%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 38% 6%, #fff 50%, transparent 52%),
    radial-gradient(1.8px 1.8px at 51% 44%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 62% 20%, #fff 50%, transparent 52%),
    radial-gradient(1.8px 1.8px at 79% 8%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 88% 34%, #fff 50%, transparent 52%);
  animation: sp-twinkle 3.2s ease-in-out infinite alternate;
}

.splash-glow {
  background: radial-gradient(circle at 50% 34%, rgba(196, 180, 255, 0.2), rgba(196, 180, 255, 0) 36%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 150, 90, 0.45), rgba(255, 150, 90, 0) 55%);
}

.splash-town {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(9vh, 56px);
  width: 100%;
  height: 27vh;
}

.splash-town .b { fill: #3b2f72; opacity: 0.75; }
.splash-town .c { fill: #241f55; }
.splash-town .f { fill: #17163d; }
.splash-town .w { fill: #ffd88a; opacity: 0.85; }
.splash-town .w.f { animation: sp-flicker 4.5s steps(1) infinite; }

.splash-road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: max(9vh, 56px);
  background:
    linear-gradient(180deg, #8a809a 0, #8a809a 3px, #2c2b45 3px, #1c1b30 100%);
}

.splash-road::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  height: 3px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 34px, transparent 34px 80px);
}

.car {
  position: absolute;
  width: clamp(70px, 9vh, 110px);
  aspect-ratio: 120 / 50;
  animation: sp-drive 11s linear infinite;
}

.car svg {
  display: block;
  width: 100%;
  height: 100%;
}

.car .beam {
  position: absolute;
  left: 92%;
  top: 48%;
  width: 120%;
  height: 46%;
  background: linear-gradient(90deg, rgba(255, 240, 190, 0.5), rgba(255, 240, 190, 0));
  clip-path: polygon(0 35%, 100% 0, 100% 100%, 0 65%);
}

.car-a { bottom: 46%; animation-duration: 12s; animation-delay: -2s; }
.car-b { bottom: 46%; animation-duration: 12s; animation-delay: -8s; }
.car-c { bottom: 6%; animation-name: sp-drive-back; animation-duration: 9s; animation-delay: -1s; }
.car-d { bottom: 6%; animation-name: sp-drive-back; animation-duration: 9s; animation-delay: -5.5s; }

/* -- die middel: karakter, logo, laai-balk */
.splash-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 5vw;
  margin-bottom: 15vh;
}

.splash-hero {
  position: relative;
  width: clamp(96px, 23vh, 210px);
  aspect-ratio: 1;
}

.splash-mascot {
  position: absolute;
  inset: 0;
  transform-origin: 50% 95%;
  animation: sp-hop 1.2s cubic-bezier(0.33, 0, 0.45, 1) infinite;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.sp-mascot {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sp-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: sp-blink 4.2s infinite;
}

.splash-shadow,
.splash-ripple {
  position: absolute;
  left: 50%;
  bottom: -4%;
  width: 62%;
  height: 12%;
  border-radius: 50%;
  transform: translateX(-50%);
}

.splash-shadow {
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
  animation: sp-shadow 1.2s cubic-bezier(0.33, 0, 0.45, 1) infinite;
}

.splash-ripple {
  border: 3px solid rgba(255, 210, 58, 0.7);
  opacity: 0;
  animation: sp-ripple 1.2s ease-out infinite;
}

.splash-logo {
  display: flex;
  margin: 1.6vh 0 0;
  font-weight: 700;
  font-size: clamp(52px, min(13vh, 17vw), 140px);
  line-height: 1;
  letter-spacing: 0.02em;
}

.splash-logo span {
  position: relative;
  display: inline-block;
  color: var(--ink);
  -webkit-text-stroke: 0.15em var(--ink);
  text-shadow: 0 0.09em 0 rgba(0, 0, 0, 0.35);
  animation: sp-drop 0.75s cubic-bezier(0.2, 1.6, 0.4, 1) both, sp-wave 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 85ms + 150ms), calc(var(--i) * 140ms + 1.2s);
}

.splash-logo span::after {
  content: attr(data-l);
  position: absolute;
  left: 0;
  top: 0;
  color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: none;
  background: linear-gradient(180deg, #fff7a0 0%, #ffd21a 48%, #ff9a0a 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.splash-sub {
  margin: 1.4vh 0 0;
  max-width: 34em;
  color: var(--sky);
  font-weight: 600;
  font-size: clamp(15px, 2.5vh, 23px);
  line-height: 1.35;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.splash-sub .nowrap {
  white-space: nowrap;
}

/* laai-balk en "gereed" deel dieselfde plek, sodat daar geen sprong is nie */
.splash-stage {
  display: grid;
  margin-top: 3vh;
  min-width: min(380px, 80vw);
}

.splash-load,
.splash-ready {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.splash-ready {
  opacity: 0;
  transform: scale(0.6);
  visibility: hidden;
}

.splash.is-ready .splash-load {
  opacity: 0;
  transform: translateY(-14px);
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
}

.splash.is-ready .splash-ready {
  opacity: 1;
  transform: none;
  visibility: visible;
}

.splash-bar {
  position: relative;
  width: min(360px, 76vw);
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.35), 0 0 22px rgba(255, 210, 58, 0.2);
  overflow: hidden;
}

.splash-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff59a 0%, #ffd21a 45%, #ff9a0a 100%);
}

.splash-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.35) 0 10px, rgba(255, 255, 255, 0) 10px 24px);
  animation: sp-stripes 0.8s linear infinite;
}

.splash-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 0 3px #3a1a00, 0 1px 2px #3a1a00;
}

.splash-tip {
  margin: 1.4vh 0 0;
  min-height: 1.4em;
  color: var(--sky);
  font-weight: 500;
  font-size: clamp(14px, 2.1vh, 18px);
  transition: opacity 0.25s ease;
}

.splash-tip.is-out {
  opacity: 0;
}

.splash-play {
  font: inherit;
  font-weight: 700;
  font-size: clamp(26px, 4.6vh, 40px);
  letter-spacing: 0.04em;
  color: #fff;
  padding: 0.38em 1.6em 0.42em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #8cf59c 0%, #3ccf5a 45%, #26a843 100%);
  text-shadow: 0 2px 0 #13652a, 0 0 2px #13652a;
  box-shadow: 0 7px 0 #1a7a33, 0 14px 30px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  animation: sp-pulse 1.3s ease-in-out infinite;
}

.splash-play:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 6px;
}

.splash-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin: 2.6vh 0 0;
  padding: 0;
  list-style: none;
}

.splash-chips li {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 12, 40, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 600;
  font-size: clamp(13px, 1.9vh, 16px);
  white-space: nowrap;
}

.splash-foot {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 6px;
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  font-size: 12px;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
  pointer-events: none;
}

/* lae skerms (foon dwars): kleiner karakter, minder spasie, geen etikette nie */
@media (max-height: 520px) {
  .splash-main {
    margin-bottom: 11vh;
  }
  .splash-hero {
    width: clamp(64px, 20vh, 120px);
  }
  .splash-mascot {
    animation-name: sp-hop-low;
  }
  .splash-logo {
    margin-top: 0.6vh;
    font-size: clamp(40px, 12vh, 90px);
  }
  .splash-sub {
    margin-top: 0.6vh;
    font-size: clamp(13px, 3.4vh, 18px);
  }
  .splash-stage {
    margin-top: 2vh;
  }
  .splash-play {
    font-size: clamp(22px, 7vh, 32px);
  }
  .splash-chips {
    display: none;
  }
  .splash-town {
    height: 22vh;
  }
}

@keyframes sp-hop-low {
  0% { transform: translateY(0) scale(1.1, 0.88); }
  12% { transform: translateY(-2%) scale(0.93, 1.09); }
  46% { transform: translateY(-14%) scale(0.98, 1.02) rotate(-4deg); }
  80% { transform: translateY(0) scale(0.95, 1.06); }
  90% { transform: translateY(0) scale(1.12, 0.86); }
  100% { transform: translateY(0) scale(1.1, 0.88); }
}

@keyframes sp-hop {
  0% { transform: translateY(0) scale(1.1, 0.88); }
  12% { transform: translateY(-3%) scale(0.93, 1.09); }
  46% { transform: translateY(-30%) scale(0.98, 1.02) rotate(-4deg); }
  80% { transform: translateY(0) scale(0.95, 1.06); }
  90% { transform: translateY(0) scale(1.12, 0.86); }
  100% { transform: translateY(0) scale(1.1, 0.88); }
}

@keyframes sp-shadow {
  0%, 90%, 100% { transform: translateX(-50%) scale(1.05); opacity: 1; }
  46% { transform: translateX(-50%) scale(0.6); opacity: 0.45; }
}

@keyframes sp-ripple {
  0%, 78% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1.7); }
}

@keyframes sp-blink {
  0%, 91%, 97%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.08); }
}

@keyframes sp-drop {
  from { opacity: 0; transform: translateY(-90%) scale(0.5) rotate(-12deg); }
  to { opacity: 1; transform: none; }
}

@keyframes sp-wave {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-7%) rotate(-2.5deg); }
}

@keyframes sp-stripes {
  to { background-position: 26px 0; }
}

@keyframes sp-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes sp-twinkle {
  from { opacity: 0.15; }
  to { opacity: 1; }
}

@keyframes sp-flicker {
  0%, 62%, 100% { opacity: 0.85; }
  63%, 70% { opacity: 0.15; }
}

@keyframes sp-drive {
  from { transform: translateX(-20vw); }
  to { transform: translateX(120vw); }
}

@keyframes sp-drive-back {
  from { transform: translateX(120vw) scaleX(-1); }
  to { transform: translateX(-20vw) scaleX(-1); }
}

@media (prefers-reduced-motion: reduce) {
  .splash *,
  .splash *::before,
  .splash *::after {
    animation: none !important;
  }
  .splash.is-leaving {
    transform: none;
    transition: opacity 0.3s ease;
  }
}

/* sigbaar vir skermlesers en soekenjins, nie op die skerm nie */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sprites {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nojs {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 8vw;
  text-align: center;
  color: #fff;
  font-family: Fredoka, 'Trebuchet MS', sans-serif;
  background: #0b0d22;
}

.nojs h1 {
  color: #ffd23a;
}


/* Weeklikse Top-10 Bynaam-oorleg */
.nick-backdrop[hidden] {
  display: none !important;
}

.nick-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 10, 30, 0.72);
  backdrop-filter: blur(4px);
  font-family: Fredoka, 'Trebuchet MS', sans-serif;
}

.nick-card {
  width: 100%;
  max-width: 440px;
  padding: 24px 26px 20px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(42, 52, 108, 0.97), rgba(22, 26, 62, 0.98));
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: #ffffff;
  text-align: center;
  animation: nickPop 0.28s cubic-bezier(0.22, 1.28, 0.36, 1);
}

@keyframes nickPop {
  from { opacity: 0; transform: scale(0.88) translateY(18px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.nick-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe36e, #ff9d14);
  color: #3a1a00;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.4px;
  box-shadow: 0 3px 0 #7a3b00;
}

.nick-card h2 {
  margin: 12px 0 4px;
  font-size: 28px;
  font-weight: 700;
  color: #ffd84a;
  text-shadow: 0 3px 0 #2a1500;
}

.nick-rank {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 600;
  color: #7cf5a0;
}

.nick-label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #c8d4ff;
  text-align: left;
}

#nick-input {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid rgba(159, 176, 255, 0.45);
  background: rgba(11, 13, 34, 0.78);
  color: #ffffff;
  font: 700 22px Fredoka, 'Trebuchet MS', sans-serif;
  text-align: center;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#nick-input::placeholder {
  color: rgba(200, 212, 255, 0.4);
  font-weight: 500;
}

#nick-input:focus {
  border-color: #ffd23a;
  box-shadow: 0 0 0 3px rgba(255, 210, 58, 0.25);
}

.nick-warn {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 172, 28, 0.18);
  border: 1.5px solid rgba(255, 196, 66, 0.75);
  color: #ffe596;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.nick-warn.pulse {
  animation: warnShake 0.34s ease;
}

@keyframes warnShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

.nick-err {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(255, 82, 74, 0.2);
  border: 1.5px solid rgba(255, 106, 90, 0.75);
  color: #ffc8c2;
  font-size: 14px;
  font-weight: 600;
}

.nick-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.nick-btn {
  flex: 1;
  padding: 12px 14px;
  border: none;
  border-radius: 999px;
  font: 700 17px Fredoka, 'Trebuchet MS', sans-serif;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.1s, filter 0.12s;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.nick-btn:hover:not(:disabled) {
  transform: scale(1.03);
  filter: brightness(1.06);
}

.nick-btn:active:not(:disabled) {
  transform: translateY(2px);
}

.nick-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.nick-btn.primary {
  flex: 1.5;
  background: linear-gradient(180deg, #5ef07c, #2ebc4b);
  box-shadow: 0 4px 0 #19742c;
}

.nick-btn.primary.warn {
  background: linear-gradient(180deg, #ffd15c, #f09014);
  box-shadow: 0 4px 0 #8a4b00;
}

.nick-btn.secondary {
  background: linear-gradient(180deg, #6472a8, #444f7c);
  box-shadow: 0 4px 0 #262d4b;
}

.nick-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: rgba(200, 212, 255, 0.7);
}

/* bynaam-venster op lae foonskerms (dwars, of met die sleutelbord oop): rol eerder as om af te sny */
@media (max-height: 520px) {
  .nick-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    padding: 10px 16px;
  }
  .nick-card {
    padding: 14px 20px 12px;
  }
  .nick-card h2 {
    margin: 6px 0 2px;
    font-size: 22px;
  }
  .nick-note {
    display: none;
  }
}
