@import url('https://fonts.googleapis.com/css2?family=Creepster&family=Nosifer&display=swap');

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

  body {
      font-family: 'Creepster', cursive;
      background: linear-gradient(135deg, #1a0033, #330066, #4d0080);
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
  }

  #outerWrapper {
      width: 100vw;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
      background: linear-gradient(135deg, #1a0033, #330066, #4d0080);
  }

  .game-container {
      width: 780px;
      /* original fixed size */
      height: 750px;
      transform-origin: top left;
      /* needed for scaling math */
      position: relative;
  }


  .game-container {
      width: 780px;
      height: 750px;
      background: radial-gradient(circle at center, #2d1b69, #1a0033);
      border: 4px solid #6a0dad;
      border-radius: 15px;
      position: relative;
      box-shadow: 0 0 30px rgba(106, 13, 173, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.3);
      overflow: hidden;

  }

      body {
            margin: 0;
            font-family: 'Arial', sans-serif;
            background: linear-gradient(135deg, #0f0f23, #1a1a4a);
            color: white;
            overflow-x: auto;
            overflow-y: auto;
        }
        
        .container {
            display: flex;
            min-height: 100vh;
            gap: 20px;
            padding: 20px;
        }
        
        .controls {
            width: 300px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
            position: absolute;
            z-index: 1;
        }
        
        .canvas-container {
            flex: 1;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 15px;
            position: relative;
            overflow: hidden;
        }
        
        canvas {
            width: 100%;
            height: 100%;
            border-radius: 15px;
            cursor: crosshair;
        }
        
        h1 {
            text-align: center;
            margin-bottom: 30px;
            background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .control-group {
            margin-bottom: 20px;
            padding: 15px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #e0e0e0;
        }
        
        select, input[type="range"] {
            width: 100%;
            margin-bottom: 10px;
            padding: 8px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 5px;
            color: white;
        }
        
        select {
            cursor: pointer;
        }
        
        select option {
            background: #1a1a4a;
            color: white;
        }
        
        .slider-container {
            margin: 10px 0;
        }
        
        .slider-label {
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            margin-bottom: 5px;
        }
        
        input[type="range"] {
            height: 6px;
            background: rgba(255, 255, 255, 0.2);
            outline: none;
            border-radius: 3px;
        }
        
        input[type="range"]::-webkit-slider-thumb {
            appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
            cursor: pointer;
        }
        
        .button {
            width: 100%;
            padding: 12px;
            margin: 8px 0;
            border: none;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 14px;
        }
        
        .add-btn {
            background: linear-gradient(45deg, #4ecdc4, #44a08d);
            color: white;
        }
        
        .add-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
        }
        
        .add-btn:disabled {
            background: #666;
            cursor: not-allowed;
            transform: none;
        }
        
        .submit-btn {
            background: linear-gradient(45deg, #ff6b6b, #ee5a52);
            color: white;
        }
        
        .submit-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
        }
        
        .action-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .undo-btn, .redo-btn {
            flex: 1;
            background: linear-gradient(45deg, #a8a8a8, #666);
            color: white;
        }
        
        .undo-btn:hover, .redo-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(168, 168, 168, 0.4);
        }
        
        .restart-btn {
            background: linear-gradient(45deg, #ff9f43, #ff6b43);
            color: white;
        }
        
        .restart-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(255, 159, 67, 0.4);
        }
        
        .instructions {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
            padding: 15px;
            margin-top: 20px;
            font-size: 12px;
            line-height: 1.4;
            border-left: 3px solid #4ecdc4;
        }
        
        .status {
            text-align: center;
            padding: 10px;
            border-radius: 8px;
            margin-top: 10px;
            font-weight: bold;
        }
        
        .status.building {
            background: rgba(78, 205, 196, 0.2);
            color: #4ecdc4;
        }
        
        .status.running {
            background: rgba(255, 107, 107, 0.2);
            color: #ff6b6b;
        }

        /* 2. Make controls scrollable and add popup effect */
#controlsSection {
    max-height: 600px;
    overflow: hidden;
    /* 
    transition: opacity 0.4s, transform 0.4s;
    opacity: 1;
    transform: scale(1); */
}

#controlsSection.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.toggle{
    cursor: pointer;
    user-select: none;
    background: none;
}

#controlsInner {
    transition: opacity 0.4s, transform 0.4s;
    opacity: 1;
    transform: scale(1);
    max-height: 400px;
    overflow-y: auto;
}

#controlsInner.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    height: 0;
}

/* Custom scrollbar for controlsInner */
#controlsInner::-webkit-scrollbar {
    width: 10px;
    background: rgba(78, 205, 196, 0.08);
    border-radius: 8px;
}

#controlsInner::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #4ecdc4, #ff6b6b);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(78, 205, 196, 0.2);
}

#controlsInner::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
}

#controlsInner::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

/* For Firefox */
#controlsInner {
    scrollbar-width: thin;
    scrollbar-color: #4ecdc4 #1a1a4a;
}

.canvas-toolbar {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 8px;
    position: absolute;
    bottom: 10px;
    z-index: 1;
}

.canvas-toolbar button {
    background: #222;
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.canvas-toolbar button:hover {
    background: #333;
}