/* ===== Basis ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif;
  color: #0a3d62;
  background-image: url('../assets/dolphin-bg.svg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #bdeaff;
}

/* ===== Handtekening bovenaan ===== */
.signature {
  margin: 0;
  padding: 18px 24px 0;
  text-align: center;
  font-family: 'Dancing Script', 'Segoe Script', 'Brush Script MT', cursive;
  font-size: clamp(4rem, 13vw, 7.5rem);
  font-weight: 700;
  line-height: 1;
  color: #2e8b57;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.7);
}

/* ===== Hero ===== */
.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.hero-overlay {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 640px;
  box-shadow: 0 8px 32px rgba(10, 61, 98, 0.25);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: #0a3d62;
  text-shadow: 0 2px 6px rgba(255, 255, 255, 0.6);
}

.hero p {
  margin: 0 0 24px;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: #145374;
}

.hero-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.hero-nav a {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  background: #0a3d62;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 12px rgba(10, 61, 98, 0.35);
}

.hero-nav a:hover {
  background: #1a6fa8;
  transform: translateY(-2px);
}

/* ===== Card sections ===== */
.card-section {
  max-width: 1000px;
  margin: 40px auto;
  padding: 32px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(10, 61, 98, 0.2);
}

.card-section h2 {
  margin-top: 0;
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: #0a3d62;
}

.instructions {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 24px;
  color: #145374;
}

/* ===== Pac-Man game ===== */
.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 532px;
}

.hud-item {
  background: #0a3d62;
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.hud-item strong {
  color: #ffe066;
}

.start-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 999px;
  background: #ffd24c;
  color: #0a3d62;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 61, 98, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.start-btn:hover {
  background: #ffc107;
  transform: translateY(-2px);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 532px;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #02102b;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(10, 61, 98, 0.35);
}

.game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 12px 24px;
  background: rgba(10, 61, 98, 0.9);
  color: #ffe066;
  border-radius: 12px;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: bold;
  text-align: center;
  pointer-events: none;
}

.game-message:empty {
  display: none;
}

/* Tweede knop (klassement / sluiten) */
.ghost-btn {
  background: #0a3d62;
  color: #fff;
}

.ghost-btn:hover {
  background: #145374;
}

/* Naaminvoer bij game over */
.name-entry {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 26px;
  background: rgba(10, 61, 98, 0.95);
  border: 2px solid #ffd24c;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  color: #fff;
  text-align: center;
  max-width: 88%;
}

.name-entry[hidden] {
  display: none;
}

.name-entry-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: bold;
}

.name-entry-score {
  margin: 0;
  font-size: 1rem;
}

.name-entry-score strong {
  color: #ffe066;
  font-size: 1.2rem;
}

.name-entry input {
  width: 100%;
  max-width: 220px;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  text-align: center;
  color: #0a3d62;
}

/* Klassement-venster */
.leaderboard {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 16, 43, 0.75);
  backdrop-filter: blur(4px);
}

.leaderboard[hidden] {
  display: none;
}

.leaderboard-card {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  background: #e6f9ff;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(10, 61, 98, 0.5);
  text-align: center;
}

.leaderboard-card h3 {
  margin: 0 0 16px;
  color: #0a3d62;
  font-size: 1.4rem;
}

.leaderboard-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  counter-reset: rank;
  text-align: left;
}

.leaderboard-list li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #145374;
}

.leaderboard-list li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.7);
}

.leaderboard-list li::before {
  content: counter(rank);
  flex: 0 0 28px;
  font-weight: bold;
  color: #0a3d62;
  text-align: right;
}

.leaderboard-list li:nth-child(1)::before { content: '🥇'; }
.leaderboard-list li:nth-child(2)::before { content: '🥈'; }
.leaderboard-list li:nth-child(3)::before { content: '🥉'; }

.leaderboard-list .lb-name {
  flex: 1 1 auto;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-list .lb-score {
  flex: 0 0 auto;
  color: #0a3d62;
  font-variant-numeric: tabular-nums;
}

.leaderboard-list li.lb-highlight {
  outline: 2px solid #ffd24c;
  background: #fff4cc;
}

.leaderboard-empty {
  color: #145374;
  margin: 0 0 16px;
}

/* D-pad controls */
.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.dpad-row {
  display: flex;
  gap: 6px;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: #1a6fa8;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(10, 61, 98, 0.3);
  transition: background 0.1s ease, transform 0.1s ease;
}

.dpad-btn:active {
  background: #0a3d62;
  transform: scale(0.95);
}

/* ===== Weetjes / facts grid ===== */
.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.fact-card {
  background: rgba(230, 249, 255, 0.9);
  border: 2px solid #bdeaff;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fact-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(10, 61, 98, 0.2);
}

.fact-icon {
  display: block;
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.fact-card h3 {
  margin: 0 0 8px;
  color: #0a3d62;
  font-size: 1.1rem;
}

.fact-card p {
  margin: 0;
  color: #145374;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 24px;
  color: #0a3d62;
  font-weight: bold;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.6);
}

/* ===== Responsive tweaks ===== */
@media (max-width: 600px) {
  .card-section {
    margin: 20px 12px;
    padding: 20px;
  }

  .dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}
