/* © MK_Kasi · Projekt-Manager · PIN-Sperrbildschirm */

/* ============================================================
   OVERLAY — Vollbild, alles dahinter verborgen
   ============================================================ */

.pin-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 25%, #0d1020 0%, #060810 55%, #020406 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Statisches Scanline-Raster */
.pin-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 2;
}

/* Vignette */
.pin-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
  z-index: 3;
}

/* Hintergrund-Grid */
.pin-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245,180,0,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,180,0,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: gridPulse 5s ease-in-out infinite;
}

/* Bewegliche Scanline */
.pin-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(245,180,0,0.06) 25%,
    rgba(245,180,0,0.14) 50%,
    rgba(245,180,0,0.06) 75%,
    transparent
  );
  animation: scanlineMove 8s linear infinite;
  z-index: 4;
  pointer-events: none;
}

/* ============================================================
   PINGUIN — HINTERGRUND-EBENE (30% Transparenz)
   ============================================================ */

.pin-pinguin-bg {
  position: absolute;
  width: 260px;
  height: 260px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.3;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.pin-pinguin-bg.korrekt { opacity: 1; }

/* Zwei übereinanderliegende Bilder für Crossfade */
.pin-pinguin-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Oberes Bild: startet transparent, hat Übergang */
#pin-pinguin-oben {
  opacity: 0;
  transition: opacity 0.45s ease;
}

/* Sofort ausblenden (kein Übergang) — per JS gesetzt */
#pin-pinguin-oben.kein-uebergang {
  transition: none;
}

/* ============================================================
   GLASRISS-SVG-OVERLAY
   ============================================================ */

.pin-risse-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 8;
  pointer-events: none;
  overflow: visible;
}

/* Riss-Gruppen: initial unsichtbar */
.pin-riss-gruppe {
  display: none;
}
.pin-riss-gruppe.sichtbar {
  display: block;
}

/* Riss-Pfade: Zeichnungs-Animation per stroke-dasharray */
.pin-riss-gruppe path {
  stroke: rgba(210, 230, 255, 0.82);
  stroke-width: 0.45;
  fill: none;
  filter: drop-shadow(0 0 0.8px rgba(255,255,255,0.95))
          drop-shadow(0 0 2.5px rgba(180,215,255,0.55));
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}

.pin-riss-gruppe path.gezeichnet {
  animation: rissZeichnen 0.5s ease forwards;
}

@keyframes rissZeichnen {
  to { stroke-dashoffset: 0; }
}

/* Einschlags-Kern */
.pin-riss-kern {
  fill: rgba(4, 6, 12, 0.96);
  stroke: rgba(200, 225, 255, 0.5);
  stroke-width: 0.3;
  filter: drop-shadow(0 0 2px rgba(180,215,255,0.9));
  opacity: 0;
}

.pin-riss-kern.gezeichnet {
  animation: kernErscheinen 0.18s ease forwards;
}

@keyframes kernErscheinen {
  to { opacity: 1; }
}

/* Heilungs-Animation nach Sperrung */
.pin-risse-svg.heilend .pin-riss-gruppe.sichtbar {
  animation: risseHeilen 4.8s ease forwards;
}

@keyframes risseHeilen {
  0%   { opacity: 1;   filter: blur(0);    }
  30%  { opacity: 0.8; filter: blur(0.3px); }
  70%  { opacity: 0.3; filter: blur(1.5px); }
  100% { opacity: 0;   filter: blur(4px);  }
}

@keyframes augenRot {
  0%   { transform: translate(-50%, -50%) scale(1); }
  30%  { transform: translate(-50%, -50%) scale(1.6); }
  65%  { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ============================================================
   INHALT-CONTAINER
   ============================================================ */

.pin-inhalt {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  width: 100%;
  max-width: 340px;
  padding: 32px 24px 24px;
}

/* ============================================================
   LOGO
   ============================================================ */

.pin-logo-bereich { display: flex; flex-direction: column; align-items: center; }

.pin-logo-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pin-logo-icon {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 0 20px rgba(245,180,0,0.45));
  animation: logoPulse 3.5s ease-in-out infinite;
  flex-shrink: 0;
}

.pin-logo-text { display: flex; flex-direction: column; }

.pin-logo-haupttext {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: #f5b400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  animation: textGlitch 12s infinite;
  display: inline-block;
}

.pin-logo-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  color: rgba(245,180,0,0.38);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ============================================================
   STATUS-TEXT
   ============================================================ */

.pin-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180,200,220,0.45);
  animation: statusBlink 5s step-end infinite;
  text-align: center;
  min-height: 16px;
  transition: color 0.2s ease;
}

.pin-status.fehler  { color: #ff4040; animation: none; }
.pin-status.erfolg  { color: #6dd5a3; animation: none; }

/* ============================================================
   PIN-PUNKTE
   ============================================================ */

.pin-dots {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.pin-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(245,180,0,0.28);
  background: transparent;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

.pin-dot.aktiv {
  background: #f5b400;
  border-color: #f5b400;
  box-shadow: 0 0 8px rgba(245,180,0,0.55), 0 0 22px rgba(245,180,0,0.18);
  transform: scale(1.18);
}

.pin-dot.fehler {
  background: #ff4040;
  border-color: #ff4040;
  box-shadow: 0 0 10px rgba(255,64,64,0.7);
  transform: scale(1.1);
}

.pin-dot.erfolg {
  background: #6dd5a3;
  border-color: #6dd5a3;
  box-shadow: 0 0 10px rgba(109,213,163,0.7);
  transform: scale(1.18);
}

.pin-dots.schuessel {
  animation: schuessel 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ============================================================
   NUMPAD
   ============================================================ */

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 78px);
  gap: 16px;
  justify-content: center;
}

.pin-btn {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.09);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  overflow: hidden;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pin-btn .pin-zahl {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 300;
  color: #d8e2ee;
  line-height: 1;
}

.pin-btn .pin-abc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.22);
  text-transform: uppercase;
  line-height: 1;
}

.pin-btn:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}

.pin-btn:active,
.pin-btn.gedrueckt {
  background: rgba(245,180,0,0.10);
  border-color: rgba(245,180,0,0.45);
  transform: scale(0.90);
}

.pin-btn:active .pin-zahl,
.pin-btn.gedrueckt .pin-zahl {
  color: #f5b400;
}

/* Ripple */
.pin-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(245,180,0,0.2);
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  transform: scale(0);
  animation: btnRipple 0.45s linear;
  pointer-events: none;
}

/* Leer-Button (Platzhalter) */
.pin-btn-leer {
  background: transparent !important;
  border-color: transparent !important;
  pointer-events: none;
  cursor: default;
}

/* Löschen-Button */
.pin-btn-del .pin-zahl { font-size: 22px; }
.pin-btn-del:active,
.pin-btn-del.gedrueckt {
  background: rgba(255,64,64,0.08);
  border-color: rgba(255,64,64,0.4);
  transform: scale(0.90);
}
.pin-btn-del:active .pin-zahl,
.pin-btn-del.gedrueckt .pin-zahl { color: #ff6060; }

/* ============================================================
   FOOTER
   ============================================================ */

.pin-footer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7.5px;
  color: rgba(255,255,255,0.1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  margin-top: -10px;
}

/* ============================================================
   ENTSPERR-ANIMATION
   ============================================================ */

.pin-overlay.entsperrt {
  animation: entsperren 0.95s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

/* ============================================================
   KEYFRAMES
   ============================================================ */

@keyframes scanlineMove {
  from { top: -4px; }
  to   { top: 100vh; }
}

@keyframes gridPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(245,180,0,0.38)); }
  50%       { filter: drop-shadow(0 0 30px rgba(245,180,0,0.7)); }
}

@keyframes textGlitch {
  0%, 82%, 100% { transform: none; text-shadow: none; clip-path: none; opacity: 1; }
  83%  { transform: translate(-3px, 0) skew(-1.5deg); text-shadow: 3px 0 #ff4040; clip-path: polygon(0 15%, 100% 15%, 100% 42%, 0 42%); }
  84%  { transform: translate(3px, 0) skew(1deg); text-shadow: -2px 0 #4a9eff; clip-path: polygon(0 55%, 100% 55%, 100% 78%, 0 78%); }
  85%  { transform: none; text-shadow: none; clip-path: none; }
  90%  { transform: translate(-1px, 0); text-shadow: 1px 0 #f5b400; clip-path: polygon(0 65%, 100% 65%, 100% 85%, 0 85%); }
  91%  { transform: none; text-shadow: none; clip-path: none; }
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  94%, 96%, 98% { opacity: 0.25; }
  95%, 97%, 99% { opacity: 1; }
}

@keyframes schuessel {
  0%,  100% { transform: translateX(0); }
  12%, 36%, 60%, 84% { transform: translateX(-13px); }
  24%, 48%, 72%       { transform: translateX(13px); }
}

@keyframes entsperren {
  0%   { opacity: 1; transform: translateY(0) scale(1);    filter: blur(0); }
  25%  { opacity: 1; transform: translateY(-12px) scale(1.01); filter: blur(0); }
  55%  { opacity: 0.5; filter: blur(3px); }
  100% { opacity: 0; transform: translateY(-100vh) scale(1.06); filter: blur(16px); }
}

@keyframes btnRipple {
  from { transform: scale(0); opacity: 0.5; }
  to   { transform: scale(2.8); opacity: 0; }
}
