:root {
  --bg: #020206;
  --ink: #ffffff;
  --glow-1: rgba(255, 255, 255, 0.45);
  --glow-2: rgba(186, 156, 255, 0.25);
  --glow-3: rgba(110, 86, 255, 0.14);
  --caution: #ffc400;
  --caution-dark: #15120a;
  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Hintergrund: sehr dunkel, Farben schimmern dezent und zufällig ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  filter: blur(70px);
}

.smear {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 1.2s ease;
  will-change: transform, opacity;
}
.smear.on { opacity: 1; }

.glim {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
  transition-property: transform, opacity;
  transition-timing-function: ease-in-out;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 25vmax rgba(0, 0, 0, 0.85);
}

/* ---------- Bühne ---------- */

.stage {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.6rem, 2.2vh, 1.4rem);
  padding: 0 16px;
}

.row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Under Construction mit Baustellen-Textur */
.row-uc {
  gap: clamp(0.6rem, 2vw, 1.2rem);
  margin-bottom: clamp(0.4rem, 2vh, 1.2rem);
  animation: neon-on 1.6s steps(1, end) both 0.2s;
}

.uc {
  font-size: clamp(0.9rem, 3.4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: transparent;
  background-image: repeating-linear-gradient(-45deg,
    var(--caution) 0 7px, var(--caution) 7px 11px,
    #2a2210 11px 15px);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 6px rgba(255, 196, 0, 0.45)) drop-shadow(0 0 22px rgba(255, 170, 0, 0.18));
  animation: stripes 3.5s linear infinite;
}

.tape {
  display: block;
  width: clamp(28px, 9vw, 110px);
  height: clamp(8px, 1.2vw, 12px);
  border-radius: 2px;
  background: repeating-linear-gradient(-45deg,
    var(--caution) 0 8px, var(--caution-dark) 8px 16px);
  background-size: 200% 100%;
  box-shadow: 0 0 14px rgba(255, 196, 0, 0.3);
  opacity: 0.9;
  animation: stripes 3.5s linear infinite;
}

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

@keyframes neon-on {
  0% { opacity: 0; }
  10% { opacity: 0.8; }
  14% { opacity: 0.1; }
  22% { opacity: 1; }
  27% { opacity: 0.3; }
  34% { opacity: 1; }
  100% { opacity: 1; }
}

/* Leuchtende weiße Schrift */
.word {
  display: inline-flex;
  line-height: 1;
  color: var(--ink);
  font-weight: 700;
  text-shadow:
    0 0 4px var(--glow-1),
    0 0 18px var(--glow-2),
    0 0 46px var(--glow-3);
  will-change: transform;
}

.row-name .word {
  font-size: clamp(2.1rem, 10vw, 8rem);
  letter-spacing: -0.01em;
}

.row-portfolio .word {
  font-size: clamp(1rem, 4.2vw, 2.6rem);
  font-weight: 500;
  letter-spacing: 0.55em;
  margin-right: -0.55em; /* letzte Sperrung ausgleichen */
  opacity: 0.92;
}

.ch {
  display: inline-block;
  white-space: pre;
  transform-origin: 50% 90%;
}

.ch.settle { animation: settle 0.7s cubic-bezier(.3, 1.6, .5, 1) both; }

@keyframes settle {
  0% { transform: translateY(0); }
  35% { transform: translateY(-0.12em); text-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 0 26px rgba(200, 170, 255, 0.5), 0 0 60px rgba(120, 90, 255, 0.3); }
  100% { transform: translateY(0); }
}

.word.glow { animation: breathe 5s ease-in-out infinite; }
@keyframes breathe {
  50% { text-shadow: 0 0 6px rgba(255, 255, 255, 0.55), 0 0 22px rgba(190, 160, 255, 0.32), 0 0 54px rgba(110, 86, 255, 0.2); }
}

.word.landing { animation: land 0.5s cubic-bezier(.2, .9, .3, 1); }
@keyframes land {
  0% { transform: scale(1.06, 0.8); }
  50% { transform: scale(0.98, 1.05); }
  100% { transform: none; }
}

/* ---------- Seil ---------- */

.rope {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
  transition: opacity 0.4s ease;
}
.rope path {
  fill: none;
  stroke: rgba(255, 235, 200, 0.75);
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(255, 220, 160, 0.6));
}
.rope.off { opacity: 0; }

/* ---------- Bauarbeiter ---------- */

.worker {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.35)) drop-shadow(0 0 12px rgba(170, 140, 255, 0.25));
}
.worker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: transform 0.18s ease;
}
.worker.face-left svg { transform: scaleX(-1); }

.worker .limb {
  fill: none;
  stroke: #fff;
  stroke-width: 4.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.worker .torso { stroke-width: 5.6; }
.worker .vest { stroke: #ff7a1a; stroke-width: 8; stroke-linecap: round; }
.worker .back { opacity: 0.72; }
.worker .head { fill: #fff; }
.worker .helmet { fill: var(--caution); }
.worker .hand { fill: transparent; }

/* Sprechblase */
.bubble {
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-bottom: 4px;
  transform: translateX(-50%) scale(0.6);
  opacity: 0;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #120c22;
  font: 700 13px/1.2 var(--font);
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
.bubble.angry { background: #ff4d4d; color: #fff; }

/* ---------- Kontakt-Button ---------- */

.contact {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  visibility: hidden;
  padding: 0.75em 1.7em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: linear-gradient(180deg, rgba(40, 34, 70, 0.95), rgba(12, 10, 26, 0.95));
  color: #fff;
  font: 700 clamp(0.85rem, 2.6vw, 1.05rem)/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 18px rgba(170, 140, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  will-change: transform;
}
.contact:hover, .contact:focus-visible {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 26px rgba(200, 180, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.contact.landed {
  visibility: visible;
  left: 50%;
  top: auto;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 2.6rem);
  transform: translateX(-50%);
}
.contact.thud { animation: thud 0.45s cubic-bezier(.2, .9, .3, 1); }
@keyframes thud {
  0% { transform: translateX(-50%) scale(1.08, 0.78); }
  45% { transform: translateX(-50%) scale(0.97, 1.04); }
  100% { transform: translateX(-50%) scale(1, 1); }
}

/* Risse im Boden nach dem Aufprall */
.contact::after {
  content: "";
  position: absolute;
  left: -30%;
  right: -30%;
  top: 100%;
  height: 14px;
  opacity: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M100 1 L88 6 L76 4 L60 10 L44 8 M88 6 L84 12 M100 1 L113 7 L126 5 L141 11 L158 9 M126 5 L131 12 M60 10 L52 13' fill='none' stroke='%23d8ccff' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  transition: opacity 0.5s ease 0.05s;
  pointer-events: none;
}
.contact.cracked::after { opacity: 0.7; }

.stage.shake { animation: shake 0.42s ease-out; }
@keyframes shake {
  15% { transform: translate(0, 5px); }
  30% { transform: translate(-3px, -3px); }
  45% { transform: translate(3px, 2px); }
  60% { transform: translate(-2px, -1px); }
  80% { transform: translate(1px, 1px); }
}

.puff.big { width: 18px; height: 18px; animation-duration: 0.9s; }

/* ---------- Fuß ---------- */

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 3;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .uc, .tape, .row-uc, .word.glow { animation: none !important; }
  .glim { transition: none !important; }
}
