  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;600&display=swap');

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

  body {
    background: #0a0e1a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
  }

  #scene {
    position: relative;
    width: 800px;
    height: 800px;
  }

  .puzzle-piece {
    position: absolute;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.3s;
    will-change: transform;
  }

  .puzzle-piece:hover {
    filter: brightness(1.3) !important;
    z-index: 100;
  }

  .piece-shape {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .piece-bg {
    position: absolute;
    inset: 0;
    border-radius: 18%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  }

  .piece-icon {
    width: 52px;
    height: 52px;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
  }

  .piece-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.6);
    padding: 2px 8px;
    border-radius: 6px;
    z-index: 3;
    pointer-events: none;
  }

  .puzzle-piece:hover .piece-label {
    opacity: 1;
  }

  .puzzle-piece.sim-hover {
    filter: brightness(1.3) !important;
    z-index: 100;
  }
  .puzzle-piece.sim-hover .piece-label {
    opacity: 1;
  }

  #sim-cursor {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 300;
    pointer-events: none;
    opacity: 0;
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), top 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
  }

  .piece-connector {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    z-index: 1;
  }

  .piece-connector.right { right: -8px; top: 50%; transform: translateY(-50%); }
  .piece-connector.left { left: -8px; top: 50%; transform: translateY(-50%); }

  .puzzle-piece.comet {
    filter: brightness(1.4) drop-shadow(0 0 12px rgba(200,200,255,0.8)) drop-shadow(0 0 25px rgba(150,150,255,0.5));
  }
  .puzzle-piece.comet::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 60px; height: 6px;
    background: linear-gradient(90deg, rgba(200,200,255,0.7), transparent);
    transform-origin: left center;
    border-radius: 3px;
    pointer-events: none;
    animation: cometPulse 0.4s ease-in-out infinite alternate;
  }
  @keyframes cometPulse {
    from { opacity: 0.5; width: 40px; }
    to { opacity: 1; width: 70px; }
  }
  @keyframes snapPulse {
    from { transform: translate(-50%,-50%) scale(0.9); opacity: 0.7; }
    to { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
  }

  #controls {
    position: fixed;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 200;
  }

  .btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 10px 28px;
    border-radius: 40px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
  }

  .btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
  }

  .btn.active {
    background: rgba(100, 180, 255, 0.2);
    border-color: rgba(100, 180, 255, 0.5);
  }

  h1 {
    position: fixed;
    top: 24px;
    font-weight: 300;
    font-size: 18px;
    color: rgba(255,255,255,1);
    letter-spacing: 4px;
    text-transform: uppercase;
  }

  canvas#particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
  }

  #scene { z-index: 10; }

  /* ===== RESPONSIVE MOBILE ===== */
  @media (max-width: 767px) {
    #scene {
      width: 400px;
      height: 400px;
    }
    .puzzle-piece {
      width: 45px;
      height: 45px;
    }
    .piece-icon {
      width: 26px;
      height: 26px;
    }
    .piece-label {
      font-size: 8px;
      padding: 1px 4px;
      border-radius: 4px;
    }
    .piece-connector {
      width: 8px;
      height: 8px;
    }
    .piece-connector.right { right: -4px; }
    .piece-connector.left { left: -4px; }
    .piece-bg {
      border-radius: 18%;
      box-shadow: 0 2px 10px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    }
    h1 {
      font-size: 14px;
      letter-spacing: 2px;
      top: 12px;
    }
    #controls {
      bottom: 16px;
    }
    #controls .btn {
      padding: 8px 20px;
      font-size: 12px;
    }
    #controls #bientot {
      font-size: 14px !important;
    }
    .puzzle-piece.comet::after {
      width: 30px;
      height: 3px;
    }
    #sim-cursor {
      width: 16px;
      height: 16px;
    }
  }
