/* PacFrans styling in dezelfde visuele lijn als de rest van de site */
body.pac-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(25, 121, 197, 0.26), transparent 42%),
    radial-gradient(circle at 90% 8%, rgba(24, 171, 194, 0.2), transparent 38%),
    #091425;
  color: #eff5ff;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.pac-main {
  width: min(1120px, 94vw);
  margin: 28px auto 44px;
}

.pac-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(12, 26, 45, 0.8), rgba(14, 44, 76, 0.5));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  animation: rise-in 700ms ease both;
}

.pac-topbar h1 {
  margin: 0;
  color: #f3f8ff;
  font-family: "Archivo", "Trebuchet MS", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.pac-topbar p {
  margin: 8px 0 0;
  color: #cfe3ff;
}

.pac-top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pac-page .back-home.secondary {
  background: linear-gradient(125deg, #18344f, #24557a);
  border-color: rgba(255, 255, 255, 0.24);
}

.pac-card {
  position: relative;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(145deg, rgba(13, 35, 59, 0.9), rgba(11, 21, 40, 0.82));
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.35);
  padding: clamp(16px, 2.5vw, 26px);
  animation: hero-slam 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pac-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.hud-item {
  margin: 0;
  color: #d5e8ff;
}

#status {
  color: #9ee6ff;
}

.pac-canvas-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #050e1b;
  touch-action: none;
}

.final-board {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  padding: 16px;
  background: radial-gradient(circle at 50% 50%, rgba(23, 57, 93, 0.92), rgba(6, 16, 31, 0.95));
  color: #eff5ff;
  opacity: 0;
  pointer-events: none;
}

.final-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(78, 210, 255, 0.22), transparent 58%);
  opacity: 0;
  pointer-events: none;
}

.final-board > * {
  position: relative;
  z-index: 1;
}

.final-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  top: -12%;
  left: var(--x);
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: var(--color);
  opacity: 0;
  transform: rotate(var(--rot));
  animation: confetti-fall 1100ms ease-out var(--delay) forwards;
}

.final-board.show {
  pointer-events: auto;
  animation: board-boom 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.final-board.show::before {
  animation: burst-ring 620ms ease-out both;
}

.final-board.win {
  background: radial-gradient(circle at 50% 50%, rgba(63, 101, 29, 0.93), rgba(11, 33, 15, 0.96));
}

.final-board.win::before {
  background: radial-gradient(circle, rgba(255, 239, 132, 0.32), transparent 58%);
}

.final-label {
  margin: 0;
  color: #9fcbf4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.final-score {
  margin: 0;
  font-size: clamp(1.45rem, 3.4vw, 2.3rem);
  font-weight: 800;
  color: #ffffff;
}

.final-message,
.final-submessage {
  margin: 0;
}

.final-message {
  color: #ffe08f;
  font-size: 1.1rem;
  font-weight: 700;
}

.final-board.win .final-message {
  color: #fff4a5;
  font-size: clamp(1.4rem, 3.6vw, 2.2rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(255, 228, 96, 0.65);
  animation: skibidi-blast 680ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.final-submessage {
  color: #c7ddf7;
}

#restartFinalBtn {
  margin: 10px auto 0;
}

@keyframes board-boom {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-10deg);
    filter: blur(7px);
  }
  55% {
    opacity: 1;
    transform: scale(1.08) rotate(2deg);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: blur(0);
  }
}

@keyframes burst-ring {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.25);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(-20px) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0.95;
    transform: translateY(120%) rotate(540deg);
  }
}

@keyframes skibidi-blast {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-12deg);
    filter: blur(6px);
  }
  55% {
    opacity: 1;
    transform: scale(1.14) rotate(3deg);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: crisp-edges;
}

.pac-help {
  margin: 14px 0 0;
  color: #afc9eb;
}

/* Native fullscreen */
:fullscreen body.pac-page,
body.pac-page:fullscreen {
  min-height: 100dvh;
}

:fullscreen .pac-main,
body.pac-page:fullscreen .pac-main {
  width: min(1300px, 98vw);
  margin: 10px auto;
}

:fullscreen .pac-card,
body.pac-page:fullscreen .pac-card {
  min-height: calc(100dvh - 110px);
  display: flex;
  flex-direction: column;
}

:fullscreen .pac-canvas-wrap,
body.pac-page:fullscreen .pac-canvas-wrap {
  flex: 1;
}

/* Fallback fullscreen voor mobiele browsers zonder volledige API-ondersteuning */
body.pac-page.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  z-index: 9999;
}

body.pac-page.pseudo-fullscreen .pac-main {
  width: 98vw;
  margin: 8px auto;
}

body.pac-page.pseudo-fullscreen .pac-card {
  min-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
}

body.pac-page.pseudo-fullscreen .pac-canvas-wrap {
  flex: 1;
}

body.pac-page.pac-game-over #status {
  color: #ff8f8f;
}

body.pac-page.pac-game-over .pac-card {
  box-shadow: 0 24px 60px rgba(140, 34, 34, 0.28);
}

@media (max-width: 760px) {
  .pac-topbar {
    flex-direction: column;
  }

  .pac-top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .pac-hud {
    gap: 8px;
  }
}
