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

body {
  background: #040008;
  color: #c0a8c8;
  font-family: system-ui, sans-serif;
  overflow: hidden;
  height: 100vh;
}

#cs-app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#cs-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #06000c;
}

#cs-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 10;
}

#cs-shards {
  font-family: 'Creepster', cursive;
  font-size: 1.1rem;
  color: #e8c0ff;
  letter-spacing: 0.08em;
}

#cs-status {
  font-size: 0.75rem;
  opacity: 0.55;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cs-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: rgba(4, 0, 8, 0.94);
  z-index: 30;
}

.cs-screen.active { display: flex; }

.cs-credit {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

#cs-start h1,
#cs-win h2,
#cs-over h2 {
  font-family: 'Creepster', cursive;
  font-size: clamp(2rem, 9vw, 4rem);
  color: #d8a0f0;
  text-shadow: 0 0 40px rgba(200, 80, 255, 0.35);
  margin-bottom: 0.5rem;
}

.cs-tagline {
  font-family: 'Creepster', cursive;
  font-size: 1.25rem;
  color: #9060a8;
  margin-bottom: 1rem;
}

.cs-sub {
  max-width: 28rem;
  line-height: 1.65;
  opacity: 0.75;
  margin-bottom: 2rem;
}

.cs-controls {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  opacity: 0.45;
}

.cs-controls kbd {
  background: rgba(255,255,255,0.06);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

#cs-play-btn,
#cs-again-btn,
#cs-retry-btn,
#cs-event-btn {
  font-family: 'Creepster', cursive;
  font-size: 1.35rem;
  padding: 0.6rem 2rem;
  background: #120818;
  color: #c080e0;
  border: 1px solid #402060;
  border-radius: 4px;
  cursor: pointer;
}

#cs-play-btn:hover,
#cs-again-btn:hover,
#cs-retry-btn:hover,
#cs-event-btn:hover {
  background: #201030;
  color: #e0b0ff;
}

#cs-event {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  width: 28rem;
  padding: 1.25rem 1.5rem;
  background: rgba(8, 0, 16, 0.96);
  border: 1px solid #502070;
  border-radius: 6px;
  z-index: 20;
  text-align: center;
  box-shadow: 0 0 50px rgba(160, 40, 200, 0.12);
}

#cs-event-text {
  white-space: pre-line;
  line-height: 1.65;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.cs-hidden { display: none !important; }

#cs-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 25;
  transition: opacity 0.06s;
}

#cs-flash.cs-on { opacity: 0.25; }

#cs-static {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: cs-static 0.15s steps(2) infinite;
}

@keyframes cs-static {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-2px, 1px); }
}

.cs-exit {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.8rem;
  color: rgba(200, 168, 200, 0.35);
  text-decoration: none;
  z-index: 40;
}

.cs-exit:hover { color: rgba(200, 168, 200, 0.75); }

#cs-win p,
#cs-over p {
  max-width: 24rem;
  line-height: 1.6;
  opacity: 0.75;
  margin-bottom: 1.5rem;
}
