/* New: full-page, click-through layer for Pac-Man + trails */
#pacman-layer {
  position: fixed;
  inset: 0;                 /* top:0; right:0; bottom:0; left:0 */
  pointer-events: none;     /* don't block clicks/scrolls on the page */
  z-index: 99999;           /* above everything */
}

/* Move CSS variables to :root so they’re usable everywhere */
:root {
  --pacman-size: 60px;    /* Fallback */
  --trail-size: 14px;     /* Fallback */
}


body {
  margin: 0;
  background-size: 100%;
  font-family: sans-serif;
}

#macbook {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: url("../assets/index/macbook.png") no-repeat center center;
  background-size: contain;
  overflow: hidden;
}

/* MacBook-Fläche soll Touchgesten annehmen, ohne die Seite zu scrollen/zoomen */
#macbook {
  touch-action: none;     /* wichtig für Pointer Events auf Mobile */
  user-select: none;
}

/* Pac-Man-Größe über CSS-Variablen (werden von JS gesetzt) */
#macbook {
  --pacman-size: 60px;    /* Fallback */
  --trail-size: 14px;     /* Fallback */
}

@media (pointer: fine) {   /* Maus / Trackpad */
  #macbook { cursor: auto; }
}
@media (pointer: coarse) { /* Touch */
  #macbook { cursor: none; }
}

.tools p {
  padding: 2% 7%;
  width: 75%;
}

@media screen and (max-width: 768px) {
  .tools p {
    /* zentrieren */ 
    width: 90%;
    position: relative;
    text-align: center;
    margin: 0 auto;
  }
  
}

#tools-container {
  position: absolute;
  top: 0; /* ← wichtig */
  left: 0; /* ← wichtig */
  width: 100%;
  height: 80%;
  overflow: hidden;
}

/* Pacman bleibt relativ zum Macbook positioniert */
.pacman {
  width: var(--pacman-size);
  height: var(--pacman-size);
  border-radius: 50%;
  background: #f2d648;
  position: absolute; /* relativ zu #macbook */
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}




#dock {
  position: absolute;
  bottom: 0%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(51, 51, 55, 0.9);
  border-radius: 12px;
  padding: 5px 10px;
  display: flex;
  gap: 1vw;
  justify-content: center;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
  box-sizing: border-box;
  max-width: 72vw;
  z-index: 1000;
}

/* Dock etwas kompakter auf sehr kleinen Screens */
@media (max-width: 520px) {
  #dock { gap: 2.5vw; padding: 4px 8px; max-width: 86vw; }
}

.tool {
  max-width: 80px;
  max-height: 80px;
  background-size: cover;
  background-position: center;
  transition: transform 0.1s ease;
  position: relative;
  z-index: 3000;
}

.tooltip {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translate(-50%, 0%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  width: 140px;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tool:hover .tooltip {
  opacity: 1;
}

.floating-tool {
  position: absolute;
  width: 50px;
  height: 50px;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  will-change: transform;
}

#score-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

#score {
  font-size: 20vw; /* skaliert mit Breite */
  font-weight: bold;
  color: rgba(255, 255, 255, 0.17);
  padding: 20px 40px;
  border-radius: 20px;
  margin: 0;
}

#highscore {
  font-weight: bold;
  font-size: 2vw; /* ebenfalls responsiv */
  color: rgba(255, 255, 255, 0.17);
}


.pacman__wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-origin: center center;
  transition: transform 0.05s linear;
  pointer-events: none;
}

.pacman__eye {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  top: 5px;
  right: 20px;
  background: #333333;
}

.pacman__mouth {
  background: black;
  position: absolute;
  width: 100%;
  height: 100%;
  clip-path: polygon(100% 74%, 44% 48%, 100% 21%);
  animation: eat 0.7s infinite;
}

@keyframes eat {
  0% {
    clip-path: polygon(100% 74%, 44% 48%, 100% 21%);
  }
  25% {
    clip-path: polygon(100% 60%, 44% 48%, 100% 40%);
  }
  50% {
    clip-path: polygon(100% 50%, 44% 48%, 100% 50%);
  }
  75% {
    clip-path: polygon(100% 59%, 44% 48%, 100% 35%);
  }
  100% {
    clip-path: polygon(100% 74%, 44% 48%, 100% 21%);
  }
}

/* 
    #mouse-cursor {
      position: absolute;
      width: 125px;
      height: 125px;
      background: #0c7500;
      border-radius: 50%;
      pointer-events: none;
    } */

.trail {
  position: absolute;
  width: var(--trail-size);
  height: var(--trail-size);
  border-radius: 50%;
  background: white;
  pointer-events: none;
  opacity: 1;
  animation: fadeOut 2s ease-out forwards;
}




@keyframes fadeOut {
  to {
    opacity: 0;
    transform: scale(0.5);
  }
}


/* ========================= */ 
/* Pacman Global als Mauszeiger */
/* ========================= */

/* ==== Globaler Cursor-Layer (click-through) ==== */
#pacman-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483647; /* ganz oben */
}

/* Pac-Man als Cursor: gleiche Optik wie dein lokaler Pacman */
#cursorPacman {
  position: absolute; /* relativ zum #pacman-layer */
  width: var(--pacman-size);
  height: var(--pacman-size);
  border-radius: 50%;
  background: #f2d648;
  overflow: hidden;
  will-change: transform, left, top;
}

/* Wrapper/Mund/Auge wiederverwenden */
#cursorPacman .pacman__wrapper { 
  width: 100%; height: 100%;
  position: relative;
  transform-origin: center center;
  transition: transform 0.05s linear;
  pointer-events: none;
}
#cursorPacman .pacman__eye {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  top: 5px; right: 20px; background: #333;
}
#cursorPacman .pacman__mouth {
  background: #000; position: absolute; width: 100%; height: 100%;
  clip-path: polygon(100% 74%, 44% 48%, 100% 21%);
  animation: eat 0.7s infinite;
}

/* Trail-Punkte dürfen auch global benutzt werden */
#pacman-layer .trail {
  position: absolute;
  width: var(--trail-size);
  height: var(--trail-size);
  border-radius: 50%;
  background: white;
  pointer-events: none;
  opacity: 1;
  animation: fadeOut 2s ease-out forwards;
}

/* „Gefressen“-Zustand für Text */
.pac-eaten {
  color: #000 !important;
  -webkit-text-fill-color: #000 !important; /* Safari */
  transition: color 0.1s linear, -webkit-text-fill-color 0.1s linear;
}

/* Optional: Zeigerform verbergen, damit nur Pac-Man sichtbar ist – nur bei präzisem Pointer */
@media (pointer: fine) {
  html, body { cursor: none; }
}

/* MacBook-Pacman standardmäßig unsichtbar */
#macbook .pacman, #macbook .trail { 
  opacity: 0; 
  transition: opacity 120ms ease;
  pointer-events: none; /* blockiert nichts, Bewegung macht dein JS */
}

/* Bei Hover in #macbook anzeigen (für Maus/Trackpad) */
#macbook:hover .pacman, #macbook .trail { 
  opacity: 1; 
}

/* Wenn wir per JS die Klasse setzen (für Touch & allgemein) */
#macbook.is-pointer-inside .pacman, #macbook .trail {
  opacity: 1;
}

/* Globalen Cursor-Pacman ausblenden, wenn im MacBook */
body.in-macbook #cursorPacman, #macbook .trail { 
  display: none;
}

/* ========================= */
/* Eat Text Animation */
/* ========================= */

/* Einzelbuchstaben */
.pac-char { display:inline; position:relative; }
.pac-char.pac-eaten {
  color:#000 !important;
  -webkit-text-fill-color:#000 !important;
  transition: color .08s linear, -webkit-text-fill-color .08s linear;
}

/* Bite-Overlays auf eigenem Layer */
#pac-bite-layer {
  position:fixed; inset:0; pointer-events:none; z-index:2147483646;
}
.pac-bite {
  position:absolute;
  width:28px; height:28px;
  background:#000;
  opacity:1;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%,
                     79% 91%, 50% 70%, 21% 91%, 32% 57%,
                     2% 35%, 39% 35%);
  will-change: transform, opacity;
  transition: opacity .6s linear;
}

/* Eat Counter */

#pac-eat-counter{
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 2147483647;
  font: 600 13px/1.2 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: #fff;
  background: rgba(0,0,0,.45);
  padding: 6px 10px;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  letter-spacing: .02em;
  user-select: none;
  pointer-events: none;
}
#pac-eat-counter .num{
  font-weight: 800;
  font-size: 15px;
  margin-left: 6px;
}
